OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 166 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
167 scoped_ptr<SSLClientSocket> ssl_socket_; | 167 scoped_ptr<SSLClientSocket> ssl_socket_; |
168 | 168 |
169 HttpResponseInfo error_response_info_; | 169 HttpResponseInfo error_response_info_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); | 171 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
172 }; | 172 }; |
173 | 173 |
174 class NET_EXPORT_PRIVATE SSLClientSocketPool | 174 class NET_EXPORT_PRIVATE SSLClientSocketPool |
175 : public ClientSocketPool, | 175 : public ClientSocketPool, |
176 public LayeredPool, | 176 public HigherLayeredPool, |
177 public SSLConfigService::Observer { | 177 public SSLConfigService::Observer { |
178 public: | 178 public: |
179 typedef SSLSocketParams SocketParams; | 179 typedef SSLSocketParams SocketParams; |
180 | 180 |
181 // Only the pools that will be used are required. i.e. if you never | 181 // Only the pools that will be used are required. i.e. if you never |
182 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. | 182 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. |
183 SSLClientSocketPool( | 183 SSLClientSocketPool( |
184 int max_sockets, | 184 int max_sockets, |
185 int max_sockets_per_group, | 185 int max_sockets_per_group, |
186 ClientSocketPoolHistograms* histograms, | 186 ClientSocketPoolHistograms* histograms, |
(...skipping 26 matching lines...) Expand all Loading... |
213 | 213 |
214 virtual void CancelRequest(const std::string& group_name, | 214 virtual void CancelRequest(const std::string& group_name, |
215 ClientSocketHandle* handle) OVERRIDE; | 215 ClientSocketHandle* handle) OVERRIDE; |
216 | 216 |
217 virtual void ReleaseSocket(const std::string& group_name, | 217 virtual void ReleaseSocket(const std::string& group_name, |
218 scoped_ptr<StreamSocket> socket, | 218 scoped_ptr<StreamSocket> socket, |
219 int id) OVERRIDE; | 219 int id) OVERRIDE; |
220 | 220 |
221 virtual void FlushWithError(int error) OVERRIDE; | 221 virtual void FlushWithError(int error) OVERRIDE; |
222 | 222 |
223 virtual bool IsStalled() const OVERRIDE; | |
224 | |
225 virtual void CloseIdleSockets() OVERRIDE; | 223 virtual void CloseIdleSockets() OVERRIDE; |
226 | 224 |
227 virtual int IdleSocketCount() const OVERRIDE; | 225 virtual int IdleSocketCount() const OVERRIDE; |
228 | 226 |
229 virtual int IdleSocketCountInGroup( | 227 virtual int IdleSocketCountInGroup( |
230 const std::string& group_name) const OVERRIDE; | 228 const std::string& group_name) const OVERRIDE; |
231 | 229 |
232 virtual LoadState GetLoadState( | 230 virtual LoadState GetLoadState( |
233 const std::string& group_name, | 231 const std::string& group_name, |
234 const ClientSocketHandle* handle) const OVERRIDE; | 232 const ClientSocketHandle* handle) const OVERRIDE; |
235 | 233 |
236 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
237 | |
238 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
239 | |
240 virtual base::DictionaryValue* GetInfoAsValue( | 234 virtual base::DictionaryValue* GetInfoAsValue( |
241 const std::string& name, | 235 const std::string& name, |
242 const std::string& type, | 236 const std::string& type, |
243 bool include_nested_pools) const OVERRIDE; | 237 bool include_nested_pools) const OVERRIDE; |
244 | 238 |
245 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 239 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
246 | 240 |
247 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; | 241 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
248 | 242 |
249 // LayeredPool implementation. | 243 // LowerLayeredPool implementation. |
| 244 virtual bool IsStalled() const OVERRIDE; |
| 245 |
| 246 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 247 |
| 248 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 249 |
| 250 // HigherLayeredPool implementation. |
250 virtual bool CloseOneIdleConnection() OVERRIDE; | 251 virtual bool CloseOneIdleConnection() OVERRIDE; |
251 | 252 |
252 private: | 253 private: |
253 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; | 254 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; |
254 | 255 |
255 // SSLConfigService::Observer implementation. | 256 // SSLConfigService::Observer implementation. |
256 | 257 |
257 // When the user changes the SSL config, we flush all idle sockets so they | 258 // When the user changes the SSL config, we flush all idle sockets so they |
258 // won't get re-used. | 259 // won't get re-used. |
259 virtual void OnSSLConfigChanged() OVERRIDE; | 260 virtual void OnSSLConfigChanged() OVERRIDE; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 HttpProxyClientSocketPool* const http_proxy_pool_; | 298 HttpProxyClientSocketPool* const http_proxy_pool_; |
298 PoolBase base_; | 299 PoolBase base_; |
299 const scoped_refptr<SSLConfigService> ssl_config_service_; | 300 const scoped_refptr<SSLConfigService> ssl_config_service_; |
300 | 301 |
301 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 302 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
302 }; | 303 }; |
303 | 304 |
304 } // namespace net | 305 } // namespace net |
305 | 306 |
306 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 307 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |