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