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