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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 153 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
154 scoped_ptr<SSLClientSocket> ssl_socket_; | 154 scoped_ptr<SSLClientSocket> ssl_socket_; |
155 | 155 |
156 HttpResponseInfo error_response_info_; | 156 HttpResponseInfo error_response_info_; |
157 | 157 |
158 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); | 158 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
159 }; | 159 }; |
160 | 160 |
161 class NET_EXPORT_PRIVATE SSLClientSocketPool | 161 class NET_EXPORT_PRIVATE SSLClientSocketPool |
162 : public ClientSocketPool, | 162 : public ClientSocketPool, |
163 public LayeredPool, | 163 public HigherLayeredPool, |
164 public SSLConfigService::Observer { | 164 public SSLConfigService::Observer { |
165 public: | 165 public: |
166 // Only the pools that will be used are required. i.e. if you never | 166 // Only the pools that will be used are required. i.e. if you never |
167 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. | 167 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. |
168 SSLClientSocketPool( | 168 SSLClientSocketPool( |
169 int max_sockets, | 169 int max_sockets, |
170 int max_sockets_per_group, | 170 int max_sockets_per_group, |
171 ClientSocketPoolHistograms* histograms, | 171 ClientSocketPoolHistograms* histograms, |
172 HostResolver* host_resolver, | 172 HostResolver* host_resolver, |
173 CertVerifier* cert_verifier, | 173 CertVerifier* cert_verifier, |
(...skipping 24 matching lines...) Expand all Loading... |
198 | 198 |
199 virtual void CancelRequest(const std::string& group_name, | 199 virtual void CancelRequest(const std::string& group_name, |
200 ClientSocketHandle* handle) OVERRIDE; | 200 ClientSocketHandle* handle) OVERRIDE; |
201 | 201 |
202 virtual void ReleaseSocket(const std::string& group_name, | 202 virtual void ReleaseSocket(const std::string& group_name, |
203 StreamSocket* socket, | 203 StreamSocket* socket, |
204 int id) OVERRIDE; | 204 int id) OVERRIDE; |
205 | 205 |
206 virtual void FlushWithError(int error) OVERRIDE; | 206 virtual void FlushWithError(int error) OVERRIDE; |
207 | 207 |
208 virtual bool IsStalled() const OVERRIDE; | |
209 | |
210 virtual void CloseIdleSockets() OVERRIDE; | 208 virtual void CloseIdleSockets() OVERRIDE; |
211 | 209 |
212 virtual int IdleSocketCount() const OVERRIDE; | 210 virtual int IdleSocketCount() const OVERRIDE; |
213 | 211 |
214 virtual int IdleSocketCountInGroup( | 212 virtual int IdleSocketCountInGroup( |
215 const std::string& group_name) const OVERRIDE; | 213 const std::string& group_name) const OVERRIDE; |
216 | 214 |
217 virtual LoadState GetLoadState( | 215 virtual LoadState GetLoadState( |
218 const std::string& group_name, | 216 const std::string& group_name, |
219 const ClientSocketHandle* handle) const OVERRIDE; | 217 const ClientSocketHandle* handle) const OVERRIDE; |
220 | 218 |
221 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
222 | |
223 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE; | |
224 | |
225 virtual base::DictionaryValue* GetInfoAsValue( | 219 virtual base::DictionaryValue* GetInfoAsValue( |
226 const std::string& name, | 220 const std::string& name, |
227 const std::string& type, | 221 const std::string& type, |
228 bool include_nested_pools) const OVERRIDE; | 222 bool include_nested_pools) const OVERRIDE; |
229 | 223 |
230 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 224 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
231 | 225 |
232 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; | 226 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
233 | 227 |
234 // LayeredPool implementation. | 228 // LowerLayeredPool implementation. |
| 229 virtual bool IsStalled() const OVERRIDE; |
| 230 |
| 231 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 232 |
| 233 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; |
| 234 |
| 235 // HigherLayeredPool implementation. |
235 virtual bool CloseOneIdleConnection() OVERRIDE; | 236 virtual bool CloseOneIdleConnection() OVERRIDE; |
236 | 237 |
237 private: | 238 private: |
238 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; | 239 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; |
239 | 240 |
240 // SSLConfigService::Observer implementation. | 241 // SSLConfigService::Observer implementation. |
241 | 242 |
242 // When the user changes the SSL config, we flush all idle sockets so they | 243 // When the user changes the SSL config, we flush all idle sockets so they |
243 // won't get re-used. | 244 // won't get re-used. |
244 virtual void OnSSLConfigChanged() OVERRIDE; | 245 virtual void OnSSLConfigChanged() OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 const scoped_refptr<SSLConfigService> ssl_config_service_; | 285 const scoped_refptr<SSLConfigService> ssl_config_service_; |
285 | 286 |
286 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 287 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
287 }; | 288 }; |
288 | 289 |
289 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); | 290 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); |
290 | 291 |
291 } // namespace net | 292 } // namespace net |
292 | 293 |
293 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 294 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |