OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // The time the DoSSLConnect() method was called. | 159 // The time the DoSSLConnect() method was called. |
160 base::TimeTicks ssl_connect_start_time_; | 160 base::TimeTicks ssl_connect_start_time_; |
161 | 161 |
162 HttpResponseInfo error_response_info_; | 162 HttpResponseInfo error_response_info_; |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); | 164 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
165 }; | 165 }; |
166 | 166 |
167 class NET_EXPORT_PRIVATE SSLClientSocketPool | 167 class NET_EXPORT_PRIVATE SSLClientSocketPool |
168 : public ClientSocketPool, | 168 : public ClientSocketPool, |
| 169 public LayeredPool, |
169 public SSLConfigService::Observer { | 170 public SSLConfigService::Observer { |
170 public: | 171 public: |
171 // Only the pools that will be used are required. i.e. if you never | 172 // Only the pools that will be used are required. i.e. if you never |
172 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. | 173 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. |
173 SSLClientSocketPool( | 174 SSLClientSocketPool( |
174 int max_sockets, | 175 int max_sockets, |
175 int max_sockets_per_group, | 176 int max_sockets_per_group, |
176 ClientSocketPoolHistograms* histograms, | 177 ClientSocketPoolHistograms* histograms, |
177 HostResolver* host_resolver, | 178 HostResolver* host_resolver, |
178 CertVerifier* cert_verifier, | 179 CertVerifier* cert_verifier, |
(...skipping 25 matching lines...) Expand all Loading... |
204 | 205 |
205 virtual void CancelRequest(const std::string& group_name, | 206 virtual void CancelRequest(const std::string& group_name, |
206 ClientSocketHandle* handle) OVERRIDE; | 207 ClientSocketHandle* handle) OVERRIDE; |
207 | 208 |
208 virtual void ReleaseSocket(const std::string& group_name, | 209 virtual void ReleaseSocket(const std::string& group_name, |
209 StreamSocket* socket, | 210 StreamSocket* socket, |
210 int id) OVERRIDE; | 211 int id) OVERRIDE; |
211 | 212 |
212 virtual void Flush() OVERRIDE; | 213 virtual void Flush() OVERRIDE; |
213 | 214 |
| 215 virtual bool IsStalled() const OVERRIDE; |
| 216 |
214 virtual void CloseIdleSockets() OVERRIDE; | 217 virtual void CloseIdleSockets() OVERRIDE; |
215 | 218 |
216 virtual int IdleSocketCount() const OVERRIDE; | 219 virtual int IdleSocketCount() const OVERRIDE; |
217 | 220 |
218 virtual int IdleSocketCountInGroup( | 221 virtual int IdleSocketCountInGroup( |
219 const std::string& group_name) const OVERRIDE; | 222 const std::string& group_name) const OVERRIDE; |
220 | 223 |
221 virtual LoadState GetLoadState( | 224 virtual LoadState GetLoadState( |
222 const std::string& group_name, | 225 const std::string& group_name, |
223 const ClientSocketHandle* handle) const OVERRIDE; | 226 const ClientSocketHandle* handle) const OVERRIDE; |
224 | 227 |
| 228 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE; |
| 229 |
| 230 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE; |
| 231 |
225 virtual base::DictionaryValue* GetInfoAsValue( | 232 virtual base::DictionaryValue* GetInfoAsValue( |
226 const std::string& name, | 233 const std::string& name, |
227 const std::string& type, | 234 const std::string& type, |
228 bool include_nested_pools) const OVERRIDE; | 235 bool include_nested_pools) const OVERRIDE; |
229 | 236 |
230 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 237 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
231 | 238 |
232 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; | 239 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
233 | 240 |
| 241 // LayeredPool implementation. |
| 242 virtual bool CloseOneIdleConnection() OVERRIDE; |
| 243 |
234 private: | 244 private: |
235 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; | 245 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; |
236 | 246 |
237 // SSLConfigService::Observer implementation. | 247 // SSLConfigService::Observer implementation. |
238 | 248 |
239 // When the user changes the SSL config, we flush all idle sockets so they | 249 // When the user changes the SSL config, we flush all idle sockets so they |
240 // won't get re-used. | 250 // won't get re-used. |
241 virtual void OnSSLConfigChanged() OVERRIDE; | 251 virtual void OnSSLConfigChanged() OVERRIDE; |
242 | 252 |
243 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { | 253 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const scoped_refptr<SSLConfigService> ssl_config_service_; | 293 const scoped_refptr<SSLConfigService> ssl_config_service_; |
284 | 294 |
285 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 295 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
286 }; | 296 }; |
287 | 297 |
288 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); | 298 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); |
289 | 299 |
290 } // namespace net | 300 } // namespace net |
291 | 301 |
292 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 302 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |