Disable overview on alt-tab by default and update test expectation to match.
[chromium-blink-merge.git] / net / socket / ssl_client_socket_pool.cc
blob5d574b7edda2f23060b09af04b750c0bf08b57cf
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
3 // found in the LICENSE file.
5 #include "net/socket/ssl_client_socket_pool.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h"
11 #include "base/metrics/sparse_histogram.h"
12 #include "base/values.h"
13 #include "net/base/host_port_pair.h"
14 #include "net/base/net_errors.h"
15 #include "net/http/http_proxy_client_socket.h"
16 #include "net/http/http_proxy_client_socket_pool.h"
17 #include "net/socket/client_socket_factory.h"
18 #include "net/socket/client_socket_handle.h"
19 #include "net/socket/socks_client_socket_pool.h"
20 #include "net/socket/ssl_client_socket.h"
21 #include "net/socket/transport_client_socket_pool.h"
22 #include "net/ssl/ssl_cert_request_info.h"
23 #include "net/ssl/ssl_connection_status_flags.h"
24 #include "net/ssl/ssl_info.h"
26 namespace net {
28 SSLSocketParams::SSLSocketParams(
29 const scoped_refptr<TransportSocketParams>& direct_params,
30 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params,
31 const scoped_refptr<HttpProxySocketParams>& http_proxy_params,
32 const HostPortPair& host_and_port,
33 const SSLConfig& ssl_config,
34 PrivacyMode privacy_mode,
35 int load_flags,
36 bool force_spdy_over_ssl,
37 bool want_spdy_over_npn)
38 : direct_params_(direct_params),
39 socks_proxy_params_(socks_proxy_params),
40 http_proxy_params_(http_proxy_params),
41 host_and_port_(host_and_port),
42 ssl_config_(ssl_config),
43 privacy_mode_(privacy_mode),
44 load_flags_(load_flags),
45 force_spdy_over_ssl_(force_spdy_over_ssl),
46 want_spdy_over_npn_(want_spdy_over_npn),
47 ignore_limits_(false) {
48 if (direct_params_) {
49 DCHECK(!socks_proxy_params_);
50 DCHECK(!http_proxy_params_);
51 ignore_limits_ = direct_params_->ignore_limits();
52 } else if (socks_proxy_params_) {
53 DCHECK(!http_proxy_params_);
54 ignore_limits_ = socks_proxy_params_->ignore_limits();
55 } else {
56 DCHECK(http_proxy_params_);
57 ignore_limits_ = http_proxy_params_->ignore_limits();
61 SSLSocketParams::~SSLSocketParams() {}
63 SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const {
64 if (direct_params_) {
65 DCHECK(!socks_proxy_params_);
66 DCHECK(!http_proxy_params_);
67 return DIRECT;
70 if (socks_proxy_params_) {
71 DCHECK(!http_proxy_params_);
72 return SOCKS_PROXY;
75 DCHECK(http_proxy_params_);
76 return HTTP_PROXY;
79 const scoped_refptr<TransportSocketParams>&
80 SSLSocketParams::GetDirectConnectionParams() const {
81 DCHECK_EQ(GetConnectionType(), DIRECT);
82 return direct_params_;
85 const scoped_refptr<SOCKSSocketParams>&
86 SSLSocketParams::GetSocksProxyConnectionParams() const {
87 DCHECK_EQ(GetConnectionType(), SOCKS_PROXY);
88 return socks_proxy_params_;
91 const scoped_refptr<HttpProxySocketParams>&
92 SSLSocketParams::GetHttpProxyConnectionParams() const {
93 DCHECK_EQ(GetConnectionType(), HTTP_PROXY);
94 return http_proxy_params_;
97 // Timeout for the SSL handshake portion of the connect.
98 static const int kSSLHandshakeTimeoutInSeconds = 30;
100 SSLConnectJob::SSLConnectJob(const std::string& group_name,
101 RequestPriority priority,
102 const scoped_refptr<SSLSocketParams>& params,
103 const base::TimeDelta& timeout_duration,
104 TransportClientSocketPool* transport_pool,
105 SOCKSClientSocketPool* socks_pool,
106 HttpProxyClientSocketPool* http_proxy_pool,
107 ClientSocketFactory* client_socket_factory,
108 HostResolver* host_resolver,
109 const SSLClientSocketContext& context,
110 Delegate* delegate,
111 NetLog* net_log)
112 : ConnectJob(group_name,
113 timeout_duration,
114 priority,
115 delegate,
116 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
117 params_(params),
118 transport_pool_(transport_pool),
119 socks_pool_(socks_pool),
120 http_proxy_pool_(http_proxy_pool),
121 client_socket_factory_(client_socket_factory),
122 host_resolver_(host_resolver),
123 context_(context.cert_verifier,
124 context.server_bound_cert_service,
125 context.transport_security_state,
126 (params->privacy_mode() == kPrivacyModeEnabled
127 ? "pm/" + context.ssl_session_cache_shard
128 : context.ssl_session_cache_shard)),
129 callback_(base::Bind(&SSLConnectJob::OnIOComplete,
130 base::Unretained(this))) {}
132 SSLConnectJob::~SSLConnectJob() {}
134 LoadState SSLConnectJob::GetLoadState() const {
135 switch (next_state_) {
136 case STATE_TUNNEL_CONNECT_COMPLETE:
137 if (transport_socket_handle_->socket())
138 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL;
139 // else, fall through.
140 case STATE_TRANSPORT_CONNECT:
141 case STATE_TRANSPORT_CONNECT_COMPLETE:
142 case STATE_SOCKS_CONNECT:
143 case STATE_SOCKS_CONNECT_COMPLETE:
144 case STATE_TUNNEL_CONNECT:
145 return transport_socket_handle_->GetLoadState();
146 case STATE_SSL_CONNECT:
147 case STATE_SSL_CONNECT_COMPLETE:
148 return LOAD_STATE_SSL_HANDSHAKE;
149 default:
150 NOTREACHED();
151 return LOAD_STATE_IDLE;
155 void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
156 // Headers in |error_response_info_| indicate a proxy tunnel setup
157 // problem. See DoTunnelConnectComplete.
158 if (error_response_info_.headers.get()) {
159 handle->set_pending_http_proxy_connection(
160 transport_socket_handle_.release());
162 handle->set_ssl_error_response_info(error_response_info_);
163 if (!connect_timing_.ssl_start.is_null())
164 handle->set_is_ssl_error(true);
167 void SSLConnectJob::OnIOComplete(int result) {
168 int rv = DoLoop(result);
169 if (rv != ERR_IO_PENDING)
170 NotifyDelegateOfCompletion(rv); // Deletes |this|.
173 int SSLConnectJob::DoLoop(int result) {
174 DCHECK_NE(next_state_, STATE_NONE);
176 int rv = result;
177 do {
178 State state = next_state_;
179 next_state_ = STATE_NONE;
180 switch (state) {
181 case STATE_TRANSPORT_CONNECT:
182 DCHECK_EQ(OK, rv);
183 rv = DoTransportConnect();
184 break;
185 case STATE_TRANSPORT_CONNECT_COMPLETE:
186 rv = DoTransportConnectComplete(rv);
187 break;
188 case STATE_SOCKS_CONNECT:
189 DCHECK_EQ(OK, rv);
190 rv = DoSOCKSConnect();
191 break;
192 case STATE_SOCKS_CONNECT_COMPLETE:
193 rv = DoSOCKSConnectComplete(rv);
194 break;
195 case STATE_TUNNEL_CONNECT:
196 DCHECK_EQ(OK, rv);
197 rv = DoTunnelConnect();
198 break;
199 case STATE_TUNNEL_CONNECT_COMPLETE:
200 rv = DoTunnelConnectComplete(rv);
201 break;
202 case STATE_SSL_CONNECT:
203 DCHECK_EQ(OK, rv);
204 rv = DoSSLConnect();
205 break;
206 case STATE_SSL_CONNECT_COMPLETE:
207 rv = DoSSLConnectComplete(rv);
208 break;
209 default:
210 NOTREACHED() << "bad state";
211 rv = ERR_FAILED;
212 break;
214 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
216 return rv;
219 int SSLConnectJob::DoTransportConnect() {
220 DCHECK(transport_pool_);
222 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE;
223 transport_socket_handle_.reset(new ClientSocketHandle());
224 scoped_refptr<TransportSocketParams> direct_params =
225 params_->GetDirectConnectionParams();
226 return transport_socket_handle_->Init(group_name(),
227 direct_params,
228 priority(),
229 callback_,
230 transport_pool_,
231 net_log());
234 int SSLConnectJob::DoTransportConnectComplete(int result) {
235 if (result == OK)
236 next_state_ = STATE_SSL_CONNECT;
238 return result;
241 int SSLConnectJob::DoSOCKSConnect() {
242 DCHECK(socks_pool_);
243 next_state_ = STATE_SOCKS_CONNECT_COMPLETE;
244 transport_socket_handle_.reset(new ClientSocketHandle());
245 scoped_refptr<SOCKSSocketParams> socks_proxy_params =
246 params_->GetSocksProxyConnectionParams();
247 return transport_socket_handle_->Init(group_name(),
248 socks_proxy_params,
249 priority(),
250 callback_,
251 socks_pool_,
252 net_log());
255 int SSLConnectJob::DoSOCKSConnectComplete(int result) {
256 if (result == OK)
257 next_state_ = STATE_SSL_CONNECT;
259 return result;
262 int SSLConnectJob::DoTunnelConnect() {
263 DCHECK(http_proxy_pool_);
264 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE;
266 transport_socket_handle_.reset(new ClientSocketHandle());
267 scoped_refptr<HttpProxySocketParams> http_proxy_params =
268 params_->GetHttpProxyConnectionParams();
269 return transport_socket_handle_->Init(group_name(),
270 http_proxy_params,
271 priority(),
272 callback_,
273 http_proxy_pool_,
274 net_log());
277 int SSLConnectJob::DoTunnelConnectComplete(int result) {
278 // Extract the information needed to prompt for appropriate proxy
279 // authentication so that when ClientSocketPoolBaseHelper calls
280 // |GetAdditionalErrorState|, we can easily set the state.
281 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
282 error_response_info_ = transport_socket_handle_->ssl_error_response_info();
283 } else if (result == ERR_PROXY_AUTH_REQUESTED ||
284 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) {
285 StreamSocket* socket = transport_socket_handle_->socket();
286 HttpProxyClientSocket* tunnel_socket =
287 static_cast<HttpProxyClientSocket*>(socket);
288 error_response_info_ = *tunnel_socket->GetConnectResponseInfo();
290 if (result < 0)
291 return result;
293 next_state_ = STATE_SSL_CONNECT;
294 return result;
297 int SSLConnectJob::DoSSLConnect() {
298 next_state_ = STATE_SSL_CONNECT_COMPLETE;
299 // Reset the timeout to just the time allowed for the SSL handshake.
300 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds));
302 // If the handle has a fresh socket, get its connect start and DNS times.
303 // This should always be the case.
304 const LoadTimingInfo::ConnectTiming& socket_connect_timing =
305 transport_socket_handle_->connect_timing();
306 if (!transport_socket_handle_->is_reused() &&
307 !socket_connect_timing.connect_start.is_null()) {
308 // Overwriting |connect_start| serves two purposes - it adjusts timing so
309 // |connect_start| doesn't include dns times, and it adjusts the time so
310 // as not to include time spent waiting for an idle socket.
311 connect_timing_.connect_start = socket_connect_timing.connect_start;
312 connect_timing_.dns_start = socket_connect_timing.dns_start;
313 connect_timing_.dns_end = socket_connect_timing.dns_end;
316 connect_timing_.ssl_start = base::TimeTicks::Now();
318 ssl_socket_ = client_socket_factory_->CreateSSLClientSocket(
319 transport_socket_handle_.Pass(),
320 params_->host_and_port(),
321 params_->ssl_config(),
322 context_);
323 return ssl_socket_->Connect(callback_);
326 int SSLConnectJob::DoSSLConnectComplete(int result) {
327 connect_timing_.ssl_end = base::TimeTicks::Now();
329 SSLClientSocket::NextProtoStatus status =
330 SSLClientSocket::kNextProtoUnsupported;
331 std::string proto;
332 std::string server_protos;
333 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket
334 // that hasn't had SSL_ImportFD called on it. If we get a certificate error
335 // here, then we know that we called SSL_ImportFD.
336 if (result == OK || IsCertificateError(result))
337 status = ssl_socket_->GetNextProto(&proto, &server_protos);
339 // If we want spdy over npn, make sure it succeeded.
340 if (status == SSLClientSocket::kNextProtoNegotiated) {
341 ssl_socket_->set_was_npn_negotiated(true);
342 NextProto protocol_negotiated =
343 SSLClientSocket::NextProtoFromString(proto);
344 ssl_socket_->set_protocol_negotiated(protocol_negotiated);
345 // If we negotiated a SPDY version, it must have been present in
346 // SSLConfig::next_protos.
347 // TODO(mbelshe): Verify this.
348 if (protocol_negotiated >= kProtoSPDYMinimumVersion &&
349 protocol_negotiated <= kProtoSPDYMaximumVersion) {
350 ssl_socket_->set_was_spdy_negotiated(true);
353 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated())
354 return ERR_NPN_NEGOTIATION_FAILED;
356 // Spdy might be turned on by default, or it might be over npn.
357 bool using_spdy = params_->force_spdy_over_ssl() ||
358 params_->want_spdy_over_npn();
360 if (result == OK ||
361 ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
362 DCHECK(!connect_timing_.ssl_start.is_null());
363 base::TimeDelta connect_duration =
364 connect_timing_.ssl_end - connect_timing_.ssl_start;
365 if (using_spdy) {
366 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2",
367 connect_duration,
368 base::TimeDelta::FromMilliseconds(1),
369 base::TimeDelta::FromMinutes(1),
370 100);
372 #if defined(SPDY_PROXY_AUTH_ORIGIN)
373 bool using_data_reduction_proxy = params_->host_and_port().Equals(
374 HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN)));
375 if (using_data_reduction_proxy) {
376 UMA_HISTOGRAM_CUSTOM_TIMES(
377 "Net.SSL_Connection_Latency_DataReductionProxy",
378 connect_duration,
379 base::TimeDelta::FromMilliseconds(1),
380 base::TimeDelta::FromMinutes(1),
381 100);
383 #endif
385 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2",
386 connect_duration,
387 base::TimeDelta::FromMilliseconds(1),
388 base::TimeDelta::FromMinutes(1),
389 100);
391 SSLInfo ssl_info;
392 ssl_socket_->GetSSLInfo(&ssl_info);
394 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite",
395 SSLConnectionStatusToCipherSuite(
396 ssl_info.connection_status));
398 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
399 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake",
400 connect_duration,
401 base::TimeDelta::FromMilliseconds(1),
402 base::TimeDelta::FromMinutes(1),
403 100);
404 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
405 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake",
406 connect_duration,
407 base::TimeDelta::FromMilliseconds(1),
408 base::TimeDelta::FromMinutes(1),
409 100);
412 const std::string& host = params_->host_and_port().host();
413 bool is_google = host == "google.com" ||
414 (host.size() > 11 &&
415 host.rfind(".google.com") == host.size() - 11);
416 if (is_google) {
417 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2",
418 connect_duration,
419 base::TimeDelta::FromMilliseconds(1),
420 base::TimeDelta::FromMinutes(1),
421 100);
422 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
423 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
424 "Resume_Handshake",
425 connect_duration,
426 base::TimeDelta::FromMilliseconds(1),
427 base::TimeDelta::FromMinutes(1),
428 100);
429 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
430 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
431 "Full_Handshake",
432 connect_duration,
433 base::TimeDelta::FromMilliseconds(1),
434 base::TimeDelta::FromMinutes(1),
435 100);
440 if (result == OK || IsCertificateError(result)) {
441 SetSocket(ssl_socket_.PassAs<StreamSocket>());
442 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
443 error_response_info_.cert_request_info = new SSLCertRequestInfo;
444 ssl_socket_->GetSSLCertRequestInfo(
445 error_response_info_.cert_request_info.get());
448 return result;
451 SSLConnectJob::State SSLConnectJob::GetInitialState(
452 SSLSocketParams::ConnectionType connection_type) {
453 switch (connection_type) {
454 case SSLSocketParams::DIRECT:
455 return STATE_TRANSPORT_CONNECT;
456 case SSLSocketParams::HTTP_PROXY:
457 return STATE_TUNNEL_CONNECT;
458 case SSLSocketParams::SOCKS_PROXY:
459 return STATE_SOCKS_CONNECT;
461 NOTREACHED();
462 return STATE_NONE;
465 int SSLConnectJob::ConnectInternal() {
466 next_state_ = GetInitialState(params_->GetConnectionType());
467 return DoLoop(OK);
470 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory(
471 TransportClientSocketPool* transport_pool,
472 SOCKSClientSocketPool* socks_pool,
473 HttpProxyClientSocketPool* http_proxy_pool,
474 ClientSocketFactory* client_socket_factory,
475 HostResolver* host_resolver,
476 const SSLClientSocketContext& context,
477 NetLog* net_log)
478 : transport_pool_(transport_pool),
479 socks_pool_(socks_pool),
480 http_proxy_pool_(http_proxy_pool),
481 client_socket_factory_(client_socket_factory),
482 host_resolver_(host_resolver),
483 context_(context),
484 net_log_(net_log) {
485 base::TimeDelta max_transport_timeout = base::TimeDelta();
486 base::TimeDelta pool_timeout;
487 if (transport_pool_)
488 max_transport_timeout = transport_pool_->ConnectionTimeout();
489 if (socks_pool_) {
490 pool_timeout = socks_pool_->ConnectionTimeout();
491 if (pool_timeout > max_transport_timeout)
492 max_transport_timeout = pool_timeout;
494 if (http_proxy_pool_) {
495 pool_timeout = http_proxy_pool_->ConnectionTimeout();
496 if (pool_timeout > max_transport_timeout)
497 max_transport_timeout = pool_timeout;
499 timeout_ = max_transport_timeout +
500 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds);
503 SSLClientSocketPool::SSLClientSocketPool(
504 int max_sockets,
505 int max_sockets_per_group,
506 ClientSocketPoolHistograms* histograms,
507 HostResolver* host_resolver,
508 CertVerifier* cert_verifier,
509 ServerBoundCertService* server_bound_cert_service,
510 TransportSecurityState* transport_security_state,
511 const std::string& ssl_session_cache_shard,
512 ClientSocketFactory* client_socket_factory,
513 TransportClientSocketPool* transport_pool,
514 SOCKSClientSocketPool* socks_pool,
515 HttpProxyClientSocketPool* http_proxy_pool,
516 SSLConfigService* ssl_config_service,
517 NetLog* net_log)
518 : transport_pool_(transport_pool),
519 socks_pool_(socks_pool),
520 http_proxy_pool_(http_proxy_pool),
521 base_(this, max_sockets, max_sockets_per_group, histograms,
522 ClientSocketPool::unused_idle_socket_timeout(),
523 ClientSocketPool::used_idle_socket_timeout(),
524 new SSLConnectJobFactory(transport_pool,
525 socks_pool,
526 http_proxy_pool,
527 client_socket_factory,
528 host_resolver,
529 SSLClientSocketContext(
530 cert_verifier,
531 server_bound_cert_service,
532 transport_security_state,
533 ssl_session_cache_shard),
534 net_log)),
535 ssl_config_service_(ssl_config_service) {
536 if (ssl_config_service_.get())
537 ssl_config_service_->AddObserver(this);
538 if (transport_pool_)
539 base_.AddLowerLayeredPool(transport_pool_);
540 if (socks_pool_)
541 base_.AddLowerLayeredPool(socks_pool_);
542 if (http_proxy_pool_)
543 base_.AddLowerLayeredPool(http_proxy_pool_);
546 SSLClientSocketPool::~SSLClientSocketPool() {
547 if (ssl_config_service_.get())
548 ssl_config_service_->RemoveObserver(this);
551 scoped_ptr<ConnectJob>
552 SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
553 const std::string& group_name,
554 const PoolBase::Request& request,
555 ConnectJob::Delegate* delegate) const {
556 return scoped_ptr<ConnectJob>(
557 new SSLConnectJob(group_name, request.priority(), request.params(),
558 ConnectionTimeout(), transport_pool_, socks_pool_,
559 http_proxy_pool_, client_socket_factory_,
560 host_resolver_, context_, delegate, net_log_));
563 base::TimeDelta
564 SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() const {
565 return timeout_;
568 int SSLClientSocketPool::RequestSocket(const std::string& group_name,
569 const void* socket_params,
570 RequestPriority priority,
571 ClientSocketHandle* handle,
572 const CompletionCallback& callback,
573 const BoundNetLog& net_log) {
574 const scoped_refptr<SSLSocketParams>* casted_socket_params =
575 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params);
577 return base_.RequestSocket(group_name, *casted_socket_params, priority,
578 handle, callback, net_log);
581 void SSLClientSocketPool::RequestSockets(
582 const std::string& group_name,
583 const void* params,
584 int num_sockets,
585 const BoundNetLog& net_log) {
586 const scoped_refptr<SSLSocketParams>* casted_params =
587 static_cast<const scoped_refptr<SSLSocketParams>*>(params);
589 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log);
592 void SSLClientSocketPool::CancelRequest(const std::string& group_name,
593 ClientSocketHandle* handle) {
594 base_.CancelRequest(group_name, handle);
597 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name,
598 scoped_ptr<StreamSocket> socket,
599 int id) {
600 base_.ReleaseSocket(group_name, socket.Pass(), id);
603 void SSLClientSocketPool::FlushWithError(int error) {
604 base_.FlushWithError(error);
607 void SSLClientSocketPool::CloseIdleSockets() {
608 base_.CloseIdleSockets();
611 int SSLClientSocketPool::IdleSocketCount() const {
612 return base_.idle_socket_count();
615 int SSLClientSocketPool::IdleSocketCountInGroup(
616 const std::string& group_name) const {
617 return base_.IdleSocketCountInGroup(group_name);
620 LoadState SSLClientSocketPool::GetLoadState(
621 const std::string& group_name, const ClientSocketHandle* handle) const {
622 return base_.GetLoadState(group_name, handle);
625 base::DictionaryValue* SSLClientSocketPool::GetInfoAsValue(
626 const std::string& name,
627 const std::string& type,
628 bool include_nested_pools) const {
629 base::DictionaryValue* dict = base_.GetInfoAsValue(name, type);
630 if (include_nested_pools) {
631 base::ListValue* list = new base::ListValue();
632 if (transport_pool_) {
633 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
634 "transport_socket_pool",
635 false));
637 if (socks_pool_) {
638 list->Append(socks_pool_->GetInfoAsValue("socks_pool",
639 "socks_pool",
640 true));
642 if (http_proxy_pool_) {
643 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool",
644 "http_proxy_pool",
645 true));
647 dict->Set("nested_pools", list);
649 return dict;
652 base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const {
653 return base_.ConnectionTimeout();
656 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const {
657 return base_.histograms();
660 bool SSLClientSocketPool::IsStalled() const {
661 return base_.IsStalled();
664 void SSLClientSocketPool::AddHigherLayeredPool(HigherLayeredPool* higher_pool) {
665 base_.AddHigherLayeredPool(higher_pool);
668 void SSLClientSocketPool::RemoveHigherLayeredPool(
669 HigherLayeredPool* higher_pool) {
670 base_.RemoveHigherLayeredPool(higher_pool);
673 bool SSLClientSocketPool::CloseOneIdleConnection() {
674 if (base_.CloseOneIdleSocket())
675 return true;
676 return base_.CloseOneIdleConnectionInHigherLayeredPool();
679 void SSLClientSocketPool::OnSSLConfigChanged() {
680 FlushWithError(ERR_NETWORK_CHANGED);
683 } // namespace net