Compute if a layer is clipped outside CalcDrawProps
[chromium-blink-merge.git] / net / socket / ssl_client_socket_pool.cc
blob3ef329ca3dd7053c4ccbeb3104bd662df4ab68c9
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_macros.h"
11 #include "base/metrics/sparse_histogram.h"
12 #include "base/profiler/scoped_tracker.h"
13 #include "base/values.h"
14 #include "net/base/host_port_pair.h"
15 #include "net/base/net_errors.h"
16 #include "net/http/http_proxy_client_socket.h"
17 #include "net/http/http_proxy_client_socket_pool.h"
18 #include "net/socket/client_socket_factory.h"
19 #include "net/socket/client_socket_handle.h"
20 #include "net/socket/socks_client_socket_pool.h"
21 #include "net/socket/ssl_client_socket.h"
22 #include "net/socket/transport_client_socket_pool.h"
23 #include "net/ssl/ssl_cert_request_info.h"
24 #include "net/ssl/ssl_connection_status_flags.h"
25 #include "net/ssl/ssl_info.h"
27 namespace net {
29 SSLSocketParams::SSLSocketParams(
30 const scoped_refptr<TransportSocketParams>& direct_params,
31 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params,
32 const scoped_refptr<HttpProxySocketParams>& http_proxy_params,
33 const HostPortPair& host_and_port,
34 const SSLConfig& ssl_config,
35 PrivacyMode privacy_mode,
36 int load_flags,
37 bool expect_spdy)
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 expect_spdy_(expect_spdy),
46 ignore_limits_(false) {
47 if (direct_params_.get()) {
48 DCHECK(!socks_proxy_params_.get());
49 DCHECK(!http_proxy_params_.get());
50 ignore_limits_ = direct_params_->ignore_limits();
51 } else if (socks_proxy_params_.get()) {
52 DCHECK(!http_proxy_params_.get());
53 ignore_limits_ = socks_proxy_params_->ignore_limits();
54 } else {
55 DCHECK(http_proxy_params_.get());
56 ignore_limits_ = http_proxy_params_->ignore_limits();
60 SSLSocketParams::~SSLSocketParams() {}
62 SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const {
63 if (direct_params_.get()) {
64 DCHECK(!socks_proxy_params_.get());
65 DCHECK(!http_proxy_params_.get());
66 return DIRECT;
69 if (socks_proxy_params_.get()) {
70 DCHECK(!http_proxy_params_.get());
71 return SOCKS_PROXY;
74 DCHECK(http_proxy_params_.get());
75 return HTTP_PROXY;
78 const scoped_refptr<TransportSocketParams>&
79 SSLSocketParams::GetDirectConnectionParams() const {
80 DCHECK_EQ(GetConnectionType(), DIRECT);
81 return direct_params_;
84 const scoped_refptr<SOCKSSocketParams>&
85 SSLSocketParams::GetSocksProxyConnectionParams() const {
86 DCHECK_EQ(GetConnectionType(), SOCKS_PROXY);
87 return socks_proxy_params_;
90 const scoped_refptr<HttpProxySocketParams>&
91 SSLSocketParams::GetHttpProxyConnectionParams() const {
92 DCHECK_EQ(GetConnectionType(), HTTP_PROXY);
93 return http_proxy_params_;
96 // Timeout for the SSL handshake portion of the connect.
97 static const int kSSLHandshakeTimeoutInSeconds = 30;
99 SSLConnectJob::SSLConnectJob(const std::string& group_name,
100 RequestPriority priority,
101 const scoped_refptr<SSLSocketParams>& params,
102 const base::TimeDelta& timeout_duration,
103 TransportClientSocketPool* transport_pool,
104 SOCKSClientSocketPool* socks_pool,
105 HttpProxyClientSocketPool* http_proxy_pool,
106 ClientSocketFactory* client_socket_factory,
107 const SSLClientSocketContext& context,
108 Delegate* delegate,
109 NetLog* net_log)
110 : ConnectJob(group_name,
111 timeout_duration,
112 priority,
113 delegate,
114 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
115 params_(params),
116 transport_pool_(transport_pool),
117 socks_pool_(socks_pool),
118 http_proxy_pool_(http_proxy_pool),
119 client_socket_factory_(client_socket_factory),
120 context_(context.cert_verifier,
121 context.channel_id_service,
122 context.transport_security_state,
123 context.cert_transparency_verifier,
124 context.cert_policy_enforcer,
125 (params->privacy_mode() == PRIVACY_MODE_ENABLED
126 ? "pm/" + context.ssl_session_cache_shard
127 : context.ssl_session_cache_shard)),
128 callback_(
129 base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))) {
132 SSLConnectJob::~SSLConnectJob() {
135 LoadState SSLConnectJob::GetLoadState() const {
136 switch (next_state_) {
137 case STATE_TUNNEL_CONNECT_COMPLETE:
138 if (transport_socket_handle_->socket())
139 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL;
140 // else, fall through.
141 case STATE_TRANSPORT_CONNECT:
142 case STATE_TRANSPORT_CONNECT_COMPLETE:
143 case STATE_SOCKS_CONNECT:
144 case STATE_SOCKS_CONNECT_COMPLETE:
145 case STATE_TUNNEL_CONNECT:
146 return transport_socket_handle_->GetLoadState();
147 case STATE_SSL_CONNECT:
148 case STATE_SSL_CONNECT_COMPLETE:
149 return LOAD_STATE_SSL_HANDSHAKE;
150 default:
151 NOTREACHED();
152 return LOAD_STATE_IDLE;
156 void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
157 // Headers in |error_response_info_| indicate a proxy tunnel setup
158 // problem. See DoTunnelConnectComplete.
159 if (error_response_info_.headers.get()) {
160 handle->set_pending_http_proxy_connection(
161 transport_socket_handle_.release());
163 handle->set_ssl_error_response_info(error_response_info_);
164 if (!connect_timing_.ssl_start.is_null())
165 handle->set_is_ssl_error(true);
166 if (ssl_socket_)
167 handle->set_ssl_failure_state(ssl_socket_->GetSSLFailureState());
169 handle->set_connection_attempts(connection_attempts_);
172 void SSLConnectJob::OnIOComplete(int result) {
173 int rv = DoLoop(result);
174 if (rv != ERR_IO_PENDING)
175 NotifyDelegateOfCompletion(rv); // Deletes |this|.
178 int SSLConnectJob::DoLoop(int result) {
179 DCHECK_NE(next_state_, STATE_NONE);
181 int rv = result;
182 do {
183 State state = next_state_;
184 next_state_ = STATE_NONE;
185 switch (state) {
186 case STATE_TRANSPORT_CONNECT:
187 DCHECK_EQ(OK, rv);
188 rv = DoTransportConnect();
189 break;
190 case STATE_TRANSPORT_CONNECT_COMPLETE:
191 rv = DoTransportConnectComplete(rv);
192 break;
193 case STATE_SOCKS_CONNECT:
194 DCHECK_EQ(OK, rv);
195 rv = DoSOCKSConnect();
196 break;
197 case STATE_SOCKS_CONNECT_COMPLETE:
198 rv = DoSOCKSConnectComplete(rv);
199 break;
200 case STATE_TUNNEL_CONNECT:
201 DCHECK_EQ(OK, rv);
202 rv = DoTunnelConnect();
203 break;
204 case STATE_TUNNEL_CONNECT_COMPLETE:
205 rv = DoTunnelConnectComplete(rv);
206 break;
207 case STATE_SSL_CONNECT:
208 DCHECK_EQ(OK, rv);
209 rv = DoSSLConnect();
210 break;
211 case STATE_SSL_CONNECT_COMPLETE:
212 rv = DoSSLConnectComplete(rv);
213 break;
214 default:
215 NOTREACHED() << "bad state";
216 rv = ERR_FAILED;
217 break;
219 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
221 return rv;
224 int SSLConnectJob::DoTransportConnect() {
225 DCHECK(transport_pool_);
227 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE;
228 transport_socket_handle_.reset(new ClientSocketHandle());
229 scoped_refptr<TransportSocketParams> direct_params =
230 params_->GetDirectConnectionParams();
231 return transport_socket_handle_->Init(group_name(), direct_params, priority(),
232 callback_, transport_pool_, net_log());
235 int SSLConnectJob::DoTransportConnectComplete(int result) {
236 connection_attempts_ = transport_socket_handle_->connection_attempts();
237 if (result == OK) {
238 next_state_ = STATE_SSL_CONNECT;
239 transport_socket_handle_->socket()->GetPeerAddress(&server_address_);
242 return result;
245 int SSLConnectJob::DoSOCKSConnect() {
246 DCHECK(socks_pool_);
247 next_state_ = STATE_SOCKS_CONNECT_COMPLETE;
248 transport_socket_handle_.reset(new ClientSocketHandle());
249 scoped_refptr<SOCKSSocketParams> socks_proxy_params =
250 params_->GetSocksProxyConnectionParams();
251 return transport_socket_handle_->Init(group_name(), socks_proxy_params,
252 priority(), callback_, socks_pool_,
253 net_log());
256 int SSLConnectJob::DoSOCKSConnectComplete(int result) {
257 if (result == OK)
258 next_state_ = STATE_SSL_CONNECT;
260 return result;
263 int SSLConnectJob::DoTunnelConnect() {
264 DCHECK(http_proxy_pool_);
265 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE;
267 transport_socket_handle_.reset(new ClientSocketHandle());
268 scoped_refptr<HttpProxySocketParams> http_proxy_params =
269 params_->GetHttpProxyConnectionParams();
270 return transport_socket_handle_->Init(group_name(), http_proxy_params,
271 priority(), callback_, http_proxy_pool_,
272 net_log());
275 int SSLConnectJob::DoTunnelConnectComplete(int result) {
276 // Extract the information needed to prompt for appropriate proxy
277 // authentication so that when ClientSocketPoolBaseHelper calls
278 // |GetAdditionalErrorState|, we can easily set the state.
279 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
280 error_response_info_ = transport_socket_handle_->ssl_error_response_info();
281 } else if (result == ERR_PROXY_AUTH_REQUESTED ||
282 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) {
283 StreamSocket* socket = transport_socket_handle_->socket();
284 ProxyClientSocket* tunnel_socket = static_cast<ProxyClientSocket*>(socket);
285 error_response_info_ = *tunnel_socket->GetConnectResponseInfo();
287 if (result < 0)
288 return result;
290 next_state_ = STATE_SSL_CONNECT;
291 return result;
294 int SSLConnectJob::DoSSLConnect() {
295 // TODO(pkasting): Remove ScopedTracker below once crbug.com/462815 is fixed.
296 tracked_objects::ScopedTracker tracking_profile(
297 FROM_HERE_WITH_EXPLICIT_FUNCTION("462815 SSLConnectJob::DoSSLConnect"));
299 next_state_ = STATE_SSL_CONNECT_COMPLETE;
301 // Reset the timeout to just the time allowed for the SSL handshake.
302 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds));
304 // If the handle has a fresh socket, get its connect start and DNS times.
305 // This should always be the case.
306 const LoadTimingInfo::ConnectTiming& socket_connect_timing =
307 transport_socket_handle_->connect_timing();
308 if (!transport_socket_handle_->is_reused() &&
309 !socket_connect_timing.connect_start.is_null()) {
310 // Overwriting |connect_start| serves two purposes - it adjusts timing so
311 // |connect_start| doesn't include dns times, and it adjusts the time so
312 // as not to include time spent waiting for an idle socket.
313 connect_timing_.connect_start = socket_connect_timing.connect_start;
314 connect_timing_.dns_start = socket_connect_timing.dns_start;
315 connect_timing_.dns_end = socket_connect_timing.dns_end;
318 connect_timing_.ssl_start = base::TimeTicks::Now();
320 ssl_socket_ = client_socket_factory_->CreateSSLClientSocket(
321 transport_socket_handle_.Pass(),
322 params_->host_and_port(),
323 params_->ssl_config(),
324 context_);
325 return ssl_socket_->Connect(callback_);
328 int SSLConnectJob::DoSSLConnectComplete(int result) {
329 // TODO(rvargas): Remove ScopedTracker below once crbug.com/462784 is fixed.
330 tracked_objects::ScopedTracker tracking_profile(
331 FROM_HERE_WITH_EXPLICIT_FUNCTION(
332 "462784 SSLConnectJob::DoSSLConnectComplete"));
334 connect_timing_.ssl_end = base::TimeTicks::Now();
336 if (result != OK && !server_address_.address().empty()) {
337 connection_attempts_.push_back(ConnectionAttempt(server_address_, result));
338 server_address_ = IPEndPoint();
341 // If we want SPDY over ALPN/NPN, make sure it succeeded.
342 if (params_->expect_spdy() &&
343 !NextProtoIsSPDY(ssl_socket_->GetNegotiatedProtocol())) {
344 return ERR_NPN_NEGOTIATION_FAILED;
347 if (result == OK ||
348 ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
349 DCHECK(!connect_timing_.ssl_start.is_null());
350 base::TimeDelta connect_duration =
351 connect_timing_.ssl_end - connect_timing_.ssl_start;
352 if (params_->expect_spdy()) {
353 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2",
354 connect_duration,
355 base::TimeDelta::FromMilliseconds(1),
356 base::TimeDelta::FromMinutes(1),
357 100);
360 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2",
361 connect_duration,
362 base::TimeDelta::FromMilliseconds(1),
363 base::TimeDelta::FromMinutes(1),
364 100);
366 SSLInfo ssl_info;
367 bool has_ssl_info = ssl_socket_->GetSSLInfo(&ssl_info);
368 DCHECK(has_ssl_info);
370 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion(
371 ssl_info.connection_status),
372 SSL_CONNECTION_VERSION_MAX);
374 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite",
375 SSLConnectionStatusToCipherSuite(
376 ssl_info.connection_status));
378 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
379 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake",
380 connect_duration,
381 base::TimeDelta::FromMilliseconds(1),
382 base::TimeDelta::FromMinutes(1),
383 100);
384 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
385 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake",
386 connect_duration,
387 base::TimeDelta::FromMilliseconds(1),
388 base::TimeDelta::FromMinutes(1),
389 100);
392 const std::string& host = params_->host_and_port().host();
393 bool is_google =
394 host == "google.com" ||
395 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11);
396 if (is_google) {
397 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2",
398 connect_duration,
399 base::TimeDelta::FromMilliseconds(1),
400 base::TimeDelta::FromMinutes(1),
401 100);
402 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
403 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
404 "Resume_Handshake",
405 connect_duration,
406 base::TimeDelta::FromMilliseconds(1),
407 base::TimeDelta::FromMinutes(1),
408 100);
409 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
410 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
411 "Full_Handshake",
412 connect_duration,
413 base::TimeDelta::FromMilliseconds(1),
414 base::TimeDelta::FromMinutes(1),
415 100);
420 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(result));
421 if (params_->ssl_config().fastradio_padding_eligible) {
422 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_FastRadioPadding",
423 std::abs(result));
426 if (result == OK || IsCertificateError(result)) {
427 SetSocket(ssl_socket_.Pass());
428 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
429 error_response_info_.cert_request_info = new SSLCertRequestInfo;
430 ssl_socket_->GetSSLCertRequestInfo(
431 error_response_info_.cert_request_info.get());
434 return result;
437 SSLConnectJob::State SSLConnectJob::GetInitialState(
438 SSLSocketParams::ConnectionType connection_type) {
439 switch (connection_type) {
440 case SSLSocketParams::DIRECT:
441 return STATE_TRANSPORT_CONNECT;
442 case SSLSocketParams::HTTP_PROXY:
443 return STATE_TUNNEL_CONNECT;
444 case SSLSocketParams::SOCKS_PROXY:
445 return STATE_SOCKS_CONNECT;
447 NOTREACHED();
448 return STATE_NONE;
451 int SSLConnectJob::ConnectInternal() {
452 next_state_ = GetInitialState(params_->GetConnectionType());
453 return DoLoop(OK);
456 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory(
457 TransportClientSocketPool* transport_pool,
458 SOCKSClientSocketPool* socks_pool,
459 HttpProxyClientSocketPool* http_proxy_pool,
460 ClientSocketFactory* client_socket_factory,
461 const SSLClientSocketContext& context,
462 NetLog* net_log)
463 : transport_pool_(transport_pool),
464 socks_pool_(socks_pool),
465 http_proxy_pool_(http_proxy_pool),
466 client_socket_factory_(client_socket_factory),
467 context_(context),
468 net_log_(net_log) {
469 base::TimeDelta max_transport_timeout = base::TimeDelta();
470 base::TimeDelta pool_timeout;
471 if (transport_pool_)
472 max_transport_timeout = transport_pool_->ConnectionTimeout();
473 if (socks_pool_) {
474 pool_timeout = socks_pool_->ConnectionTimeout();
475 if (pool_timeout > max_transport_timeout)
476 max_transport_timeout = pool_timeout;
478 if (http_proxy_pool_) {
479 pool_timeout = http_proxy_pool_->ConnectionTimeout();
480 if (pool_timeout > max_transport_timeout)
481 max_transport_timeout = pool_timeout;
483 timeout_ = max_transport_timeout +
484 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds);
487 SSLClientSocketPool::SSLConnectJobFactory::~SSLConnectJobFactory() {
490 SSLClientSocketPool::SSLClientSocketPool(
491 int max_sockets,
492 int max_sockets_per_group,
493 CertVerifier* cert_verifier,
494 ChannelIDService* channel_id_service,
495 TransportSecurityState* transport_security_state,
496 CTVerifier* cert_transparency_verifier,
497 CertPolicyEnforcer* cert_policy_enforcer,
498 const std::string& ssl_session_cache_shard,
499 ClientSocketFactory* client_socket_factory,
500 TransportClientSocketPool* transport_pool,
501 SOCKSClientSocketPool* socks_pool,
502 HttpProxyClientSocketPool* http_proxy_pool,
503 SSLConfigService* ssl_config_service,
504 NetLog* net_log)
505 : transport_pool_(transport_pool),
506 socks_pool_(socks_pool),
507 http_proxy_pool_(http_proxy_pool),
508 base_(this,
509 max_sockets,
510 max_sockets_per_group,
511 ClientSocketPool::unused_idle_socket_timeout(),
512 ClientSocketPool::used_idle_socket_timeout(),
513 new SSLConnectJobFactory(
514 transport_pool,
515 socks_pool,
516 http_proxy_pool,
517 client_socket_factory,
518 SSLClientSocketContext(cert_verifier,
519 channel_id_service,
520 transport_security_state,
521 cert_transparency_verifier,
522 cert_policy_enforcer,
523 ssl_session_cache_shard),
524 net_log)),
525 ssl_config_service_(ssl_config_service) {
526 if (ssl_config_service_.get())
527 ssl_config_service_->AddObserver(this);
528 if (transport_pool_)
529 base_.AddLowerLayeredPool(transport_pool_);
530 if (socks_pool_)
531 base_.AddLowerLayeredPool(socks_pool_);
532 if (http_proxy_pool_)
533 base_.AddLowerLayeredPool(http_proxy_pool_);
536 SSLClientSocketPool::~SSLClientSocketPool() {
537 if (ssl_config_service_.get())
538 ssl_config_service_->RemoveObserver(this);
541 scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
542 const std::string& group_name,
543 const PoolBase::Request& request,
544 ConnectJob::Delegate* delegate) const {
545 return scoped_ptr<ConnectJob>(new SSLConnectJob(group_name,
546 request.priority(),
547 request.params(),
548 ConnectionTimeout(),
549 transport_pool_,
550 socks_pool_,
551 http_proxy_pool_,
552 client_socket_factory_,
553 context_,
554 delegate,
555 net_log_));
558 base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout()
559 const {
560 return timeout_;
563 int SSLClientSocketPool::RequestSocket(const std::string& group_name,
564 const void* socket_params,
565 RequestPriority priority,
566 ClientSocketHandle* handle,
567 const CompletionCallback& callback,
568 const BoundNetLog& net_log) {
569 const scoped_refptr<SSLSocketParams>* casted_socket_params =
570 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params);
572 return base_.RequestSocket(group_name, *casted_socket_params, priority,
573 handle, callback, net_log);
576 void SSLClientSocketPool::RequestSockets(
577 const std::string& group_name,
578 const void* params,
579 int num_sockets,
580 const BoundNetLog& net_log) {
581 const scoped_refptr<SSLSocketParams>* casted_params =
582 static_cast<const scoped_refptr<SSLSocketParams>*>(params);
584 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log);
587 void SSLClientSocketPool::CancelRequest(const std::string& group_name,
588 ClientSocketHandle* handle) {
589 base_.CancelRequest(group_name, handle);
592 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name,
593 scoped_ptr<StreamSocket> socket,
594 int id) {
595 base_.ReleaseSocket(group_name, socket.Pass(), id);
598 void SSLClientSocketPool::FlushWithError(int error) {
599 base_.FlushWithError(error);
602 void SSLClientSocketPool::CloseIdleSockets() {
603 base_.CloseIdleSockets();
606 int SSLClientSocketPool::IdleSocketCount() const {
607 return base_.idle_socket_count();
610 int SSLClientSocketPool::IdleSocketCountInGroup(
611 const std::string& group_name) const {
612 return base_.IdleSocketCountInGroup(group_name);
615 LoadState SSLClientSocketPool::GetLoadState(
616 const std::string& group_name, const ClientSocketHandle* handle) const {
617 return base_.GetLoadState(group_name, handle);
620 scoped_ptr<base::DictionaryValue> SSLClientSocketPool::GetInfoAsValue(
621 const std::string& name,
622 const std::string& type,
623 bool include_nested_pools) const {
624 scoped_ptr<base::DictionaryValue> dict(base_.GetInfoAsValue(name, type));
625 if (include_nested_pools) {
626 base::ListValue* list = new base::ListValue();
627 if (transport_pool_) {
628 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
629 "transport_socket_pool",
630 false));
632 if (socks_pool_) {
633 list->Append(socks_pool_->GetInfoAsValue("socks_pool",
634 "socks_pool",
635 true));
637 if (http_proxy_pool_) {
638 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool",
639 "http_proxy_pool",
640 true));
642 dict->Set("nested_pools", list);
644 return dict.Pass();
647 base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const {
648 return base_.ConnectionTimeout();
651 bool SSLClientSocketPool::IsStalled() const {
652 return base_.IsStalled();
655 void SSLClientSocketPool::AddHigherLayeredPool(HigherLayeredPool* higher_pool) {
656 base_.AddHigherLayeredPool(higher_pool);
659 void SSLClientSocketPool::RemoveHigherLayeredPool(
660 HigherLayeredPool* higher_pool) {
661 base_.RemoveHigherLayeredPool(higher_pool);
664 bool SSLClientSocketPool::CloseOneIdleConnection() {
665 if (base_.CloseOneIdleSocket())
666 return true;
667 return base_.CloseOneIdleConnectionInHigherLayeredPool();
670 void SSLClientSocketPool::OnSSLConfigChanged() {
671 FlushWithError(ERR_NETWORK_CHANGED);
674 } // namespace net