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