Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: net/socket/ssl_client_socket_pool.h

Issue 8340012: Close idle connections / SPDY sessions when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // The time the DoSSLConnect() method was called. 161 // The time the DoSSLConnect() method was called.
162 base::TimeTicks ssl_connect_start_time_; 162 base::TimeTicks ssl_connect_start_time_;
163 163
164 HttpResponseInfo error_response_info_; 164 HttpResponseInfo error_response_info_;
165 165
166 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); 166 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob);
167 }; 167 };
168 168
169 class NET_EXPORT_PRIVATE SSLClientSocketPool 169 class NET_EXPORT_PRIVATE SSLClientSocketPool
170 : public ClientSocketPool, 170 : public ClientSocketPool,
171 public LayeredPool,
171 public SSLConfigService::Observer { 172 public SSLConfigService::Observer {
172 public: 173 public:
173 // Only the pools that will be used are required. i.e. if you never 174 // 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. 175 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL.
175 SSLClientSocketPool( 176 SSLClientSocketPool(
176 int max_sockets, 177 int max_sockets,
177 int max_sockets_per_group, 178 int max_sockets_per_group,
178 ClientSocketPoolHistograms* histograms, 179 ClientSocketPoolHistograms* histograms,
179 HostResolver* host_resolver, 180 HostResolver* host_resolver,
180 CertVerifier* cert_verifier, 181 CertVerifier* cert_verifier,
181 OriginBoundCertService* origin_bound_cert_service, 182 OriginBoundCertService* origin_bound_cert_service,
182 DnsRRResolver* dnsrr_resolver, 183 DnsRRResolver* dnsrr_resolver,
183 DnsCertProvenanceChecker* dns_cert_checker, 184 DnsCertProvenanceChecker* dns_cert_checker,
184 SSLHostInfoFactory* ssl_host_info_factory, 185 SSLHostInfoFactory* ssl_host_info_factory,
185 ClientSocketFactory* client_socket_factory, 186 ClientSocketFactory* client_socket_factory,
186 TransportClientSocketPool* transport_pool, 187 TransportClientSocketPool* transport_pool,
187 SOCKSClientSocketPool* socks_pool, 188 SOCKSClientSocketPool* socks_pool,
188 HttpProxyClientSocketPool* http_proxy_pool, 189 HttpProxyClientSocketPool* http_proxy_pool,
189 SSLConfigService* ssl_config_service, 190 SSLConfigService* ssl_config_service,
190 NetLog* net_log); 191 NetLog* net_log);
191 192
192 virtual ~SSLClientSocketPool(); 193 virtual ~SSLClientSocketPool();
193 194
194 // ClientSocketPool methods: 195 // ClientSocketPool methods:
195 virtual int RequestSocket(const std::string& group_name, 196 virtual int RequestSocket(const std::string& group_name,
196 const void* connect_params, 197 const void* connect_params,
197 RequestPriority priority, 198 RequestPriority priority,
198 ClientSocketHandle* handle, 199 ClientSocketHandle* handle,
199 OldCompletionCallback* callback, 200 OldCompletionCallback* callback,
200 const BoundNetLog& net_log); 201 const BoundNetLog& net_log) OVERRIDE;
201 202
202 virtual void RequestSockets(const std::string& group_name, 203 virtual void RequestSockets(const std::string& group_name,
203 const void* params, 204 const void* params,
204 int num_sockets, 205 int num_sockets,
205 const BoundNetLog& net_log); 206 const BoundNetLog& net_log) OVERRIDE;
206 207
207 virtual void CancelRequest(const std::string& group_name, 208 virtual void CancelRequest(const std::string& group_name,
208 ClientSocketHandle* handle); 209 ClientSocketHandle* handle) OVERRIDE;
209 210
210 virtual void ReleaseSocket(const std::string& group_name, 211 virtual void ReleaseSocket(const std::string& group_name,
211 StreamSocket* socket, 212 StreamSocket* socket,
212 int id); 213 int id) OVERRIDE;
213 214
214 virtual void Flush(); 215 virtual void Flush() OVERRIDE;
215 216
216 virtual void CloseIdleSockets(); 217 virtual bool IsStalled() const OVERRIDE;
217 218
218 virtual int IdleSocketCount() const; 219 virtual void CloseIdleSockets() OVERRIDE;
219 220
220 virtual int IdleSocketCountInGroup(const std::string& group_name) const; 221 virtual int IdleSocketCount() const OVERRIDE;
221 222
222 virtual LoadState GetLoadState(const std::string& group_name, 223 virtual int IdleSocketCountInGroup(
223 const ClientSocketHandle* handle) const; 224 const std::string& group_name) const OVERRIDE;
225
226 virtual LoadState GetLoadState(
227 const std::string& group_name,
228 const ClientSocketHandle* handle) const OVERRIDE;
229
230 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE;
231
232 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE;
224 233
225 virtual base::DictionaryValue* GetInfoAsValue( 234 virtual base::DictionaryValue* GetInfoAsValue(
226 const std::string& name, 235 const std::string& name,
227 const std::string& type, 236 const std::string& type,
228 bool include_nested_pools) const; 237 bool include_nested_pools) const OVERRIDE;
229 238
230 virtual base::TimeDelta ConnectionTimeout() const; 239 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE;
231 240
232 virtual ClientSocketPoolHistograms* histograms() const; 241 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE;
242
243 // LayeredPool methods:
244 virtual bool CloseOneIdleConnection() OVERRIDE;
233 245
234 private: 246 private:
235 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase; 247 typedef ClientSocketPoolBase<SSLSocketParams> PoolBase;
236 248
237 // SSLConfigService::Observer methods: 249 // SSLConfigService::Observer methods:
238 250
239 // When the user changes the SSL config, we flush all idle sockets so they 251 // When the user changes the SSL config, we flush all idle sockets so they
240 // won't get re-used. 252 // won't get re-used.
241 virtual void OnSSLConfigChanged(); 253 virtual void OnSSLConfigChanged();
242 254
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const scoped_refptr<SSLConfigService> ssl_config_service_; 293 const scoped_refptr<SSLConfigService> ssl_config_service_;
282 294
283 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); 295 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool);
284 }; 296 };
285 297
286 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); 298 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams);
287 299
288 } // namespace net 300 } // namespace net
289 301
290 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ 302 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698