| 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 #include "net/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ignore_limits_ = direct_params_->ignore_limits(); | 51 ignore_limits_ = direct_params_->ignore_limits(); |
| 52 } else if (socks_proxy_params_) { | 52 } else if (socks_proxy_params_) { |
| 53 DCHECK(!http_proxy_params_); | 53 DCHECK(!http_proxy_params_); |
| 54 ignore_limits_ = socks_proxy_params_->ignore_limits(); | 54 ignore_limits_ = socks_proxy_params_->ignore_limits(); |
| 55 } else { | 55 } else { |
| 56 DCHECK(http_proxy_params_); | 56 DCHECK(http_proxy_params_); |
| 57 ignore_limits_ = http_proxy_params_->ignore_limits(); | 57 ignore_limits_ = http_proxy_params_->ignore_limits(); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 SSLSocketParams::~SSLSocketParams() {} | 61 SSLSocketParams::~SSLSocketParams() { |
| 62 } |
| 62 | 63 |
| 63 SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const { | 64 SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const { |
| 64 if (direct_params_) { | 65 if (direct_params_) { |
| 65 DCHECK(!socks_proxy_params_); | 66 DCHECK(!socks_proxy_params_); |
| 66 DCHECK(!http_proxy_params_); | 67 DCHECK(!http_proxy_params_); |
| 67 return DIRECT; | 68 return DIRECT; |
| 68 } | 69 } |
| 69 | 70 |
| 70 if (socks_proxy_params_) { | 71 if (socks_proxy_params_) { |
| 71 DCHECK(!http_proxy_params_); | 72 DCHECK(!http_proxy_params_); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 http_proxy_pool_(http_proxy_pool), | 121 http_proxy_pool_(http_proxy_pool), |
| 121 client_socket_factory_(client_socket_factory), | 122 client_socket_factory_(client_socket_factory), |
| 122 host_resolver_(host_resolver), | 123 host_resolver_(host_resolver), |
| 123 context_(context.cert_verifier, | 124 context_(context.cert_verifier, |
| 124 context.server_bound_cert_service, | 125 context.server_bound_cert_service, |
| 125 context.transport_security_state, | 126 context.transport_security_state, |
| 126 context.cert_transparency_verifier, | 127 context.cert_transparency_verifier, |
| 127 (params->privacy_mode() == PRIVACY_MODE_ENABLED | 128 (params->privacy_mode() == PRIVACY_MODE_ENABLED |
| 128 ? "pm/" + context.ssl_session_cache_shard | 129 ? "pm/" + context.ssl_session_cache_shard |
| 129 : context.ssl_session_cache_shard)), | 130 : context.ssl_session_cache_shard)), |
| 130 callback_(base::Bind(&SSLConnectJob::OnIOComplete, | 131 callback_( |
| 131 base::Unretained(this))) {} | 132 base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))) { |
| 133 } |
| 132 | 134 |
| 133 SSLConnectJob::~SSLConnectJob() {} | 135 SSLConnectJob::~SSLConnectJob() { |
| 136 } |
| 134 | 137 |
| 135 LoadState SSLConnectJob::GetLoadState() const { | 138 LoadState SSLConnectJob::GetLoadState() const { |
| 136 switch (next_state_) { | 139 switch (next_state_) { |
| 137 case STATE_TUNNEL_CONNECT_COMPLETE: | 140 case STATE_TUNNEL_CONNECT_COMPLETE: |
| 138 if (transport_socket_handle_->socket()) | 141 if (transport_socket_handle_->socket()) |
| 139 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; | 142 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; |
| 140 // else, fall through. | 143 // else, fall through. |
| 141 case STATE_TRANSPORT_CONNECT: | 144 case STATE_TRANSPORT_CONNECT: |
| 142 case STATE_TRANSPORT_CONNECT_COMPLETE: | 145 case STATE_TRANSPORT_CONNECT_COMPLETE: |
| 143 case STATE_SOCKS_CONNECT: | 146 case STATE_SOCKS_CONNECT: |
| 144 case STATE_SOCKS_CONNECT_COMPLETE: | 147 case STATE_SOCKS_CONNECT_COMPLETE: |
| 145 case STATE_TUNNEL_CONNECT: | 148 case STATE_TUNNEL_CONNECT: |
| 146 return transport_socket_handle_->GetLoadState(); | 149 return transport_socket_handle_->GetLoadState(); |
| 147 case STATE_SSL_CONNECT: | 150 case STATE_SSL_CONNECT: |
| 148 case STATE_SSL_CONNECT_COMPLETE: | 151 case STATE_SSL_CONNECT_COMPLETE: |
| 149 return LOAD_STATE_SSL_HANDSHAKE; | 152 return LOAD_STATE_SSL_HANDSHAKE; |
| 150 default: | 153 default: |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 std::string server_protos; | 336 std::string server_protos; |
| 334 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket | 337 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket |
| 335 // that hasn't had SSL_ImportFD called on it. If we get a certificate error | 338 // that hasn't had SSL_ImportFD called on it. If we get a certificate error |
| 336 // here, then we know that we called SSL_ImportFD. | 339 // here, then we know that we called SSL_ImportFD. |
| 337 if (result == OK || IsCertificateError(result)) | 340 if (result == OK || IsCertificateError(result)) |
| 338 status = ssl_socket_->GetNextProto(&proto, &server_protos); | 341 status = ssl_socket_->GetNextProto(&proto, &server_protos); |
| 339 | 342 |
| 340 // If we want spdy over npn, make sure it succeeded. | 343 // If we want spdy over npn, make sure it succeeded. |
| 341 if (status == SSLClientSocket::kNextProtoNegotiated) { | 344 if (status == SSLClientSocket::kNextProtoNegotiated) { |
| 342 ssl_socket_->set_was_npn_negotiated(true); | 345 ssl_socket_->set_was_npn_negotiated(true); |
| 343 NextProto protocol_negotiated = | 346 NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto); |
| 344 SSLClientSocket::NextProtoFromString(proto); | |
| 345 ssl_socket_->set_protocol_negotiated(protocol_negotiated); | 347 ssl_socket_->set_protocol_negotiated(protocol_negotiated); |
| 346 // If we negotiated a SPDY version, it must have been present in | 348 // If we negotiated a SPDY version, it must have been present in |
| 347 // SSLConfig::next_protos. | 349 // SSLConfig::next_protos. |
| 348 // TODO(mbelshe): Verify this. | 350 // TODO(mbelshe): Verify this. |
| 349 if (protocol_negotiated >= kProtoSPDYMinimumVersion && | 351 if (protocol_negotiated >= kProtoSPDYMinimumVersion && |
| 350 protocol_negotiated <= kProtoSPDYMaximumVersion) { | 352 protocol_negotiated <= kProtoSPDYMaximumVersion) { |
| 351 ssl_socket_->set_was_spdy_negotiated(true); | 353 ssl_socket_->set_was_spdy_negotiated(true); |
| 352 } | 354 } |
| 353 } | 355 } |
| 354 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated()) | 356 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated()) |
| 355 return ERR_NPN_NEGOTIATION_FAILED; | 357 return ERR_NPN_NEGOTIATION_FAILED; |
| 356 | 358 |
| 357 // Spdy might be turned on by default, or it might be over npn. | 359 // Spdy might be turned on by default, or it might be over npn. |
| 358 bool using_spdy = params_->force_spdy_over_ssl() || | 360 bool using_spdy = |
| 359 params_->want_spdy_over_npn(); | 361 params_->force_spdy_over_ssl() || params_->want_spdy_over_npn(); |
| 360 | 362 |
| 361 if (result == OK || | 363 if (result == OK || |
| 362 ssl_socket_->IgnoreCertError(result, params_->load_flags())) { | 364 ssl_socket_->IgnoreCertError(result, params_->load_flags())) { |
| 363 DCHECK(!connect_timing_.ssl_start.is_null()); | 365 DCHECK(!connect_timing_.ssl_start.is_null()); |
| 364 base::TimeDelta connect_duration = | 366 base::TimeDelta connect_duration = |
| 365 connect_timing_.ssl_end - connect_timing_.ssl_start; | 367 connect_timing_.ssl_end - connect_timing_.ssl_start; |
| 366 if (using_spdy) { | 368 if (using_spdy) { |
| 367 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2", | 369 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2", |
| 368 connect_duration, | 370 connect_duration, |
| 369 base::TimeDelta::FromMilliseconds(1), | 371 base::TimeDelta::FromMilliseconds(1), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 385 | 387 |
| 386 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2", | 388 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2", |
| 387 connect_duration, | 389 connect_duration, |
| 388 base::TimeDelta::FromMilliseconds(1), | 390 base::TimeDelta::FromMilliseconds(1), |
| 389 base::TimeDelta::FromMinutes(1), | 391 base::TimeDelta::FromMinutes(1), |
| 390 100); | 392 100); |
| 391 | 393 |
| 392 SSLInfo ssl_info; | 394 SSLInfo ssl_info; |
| 393 ssl_socket_->GetSSLInfo(&ssl_info); | 395 ssl_socket_->GetSSLInfo(&ssl_info); |
| 394 | 396 |
| 395 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite", | 397 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 396 SSLConnectionStatusToCipherSuite( | 398 "Net.SSL_CipherSuite", |
| 397 ssl_info.connection_status)); | 399 SSLConnectionStatusToCipherSuite(ssl_info.connection_status)); |
| 398 | 400 |
| 399 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { | 401 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { |
| 400 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", | 402 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", |
| 401 connect_duration, | 403 connect_duration, |
| 402 base::TimeDelta::FromMilliseconds(1), | 404 base::TimeDelta::FromMilliseconds(1), |
| 403 base::TimeDelta::FromMinutes(1), | 405 base::TimeDelta::FromMinutes(1), |
| 404 100); | 406 100); |
| 405 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 407 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
| 406 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", | 408 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", |
| 407 connect_duration, | 409 connect_duration, |
| 408 base::TimeDelta::FromMilliseconds(1), | 410 base::TimeDelta::FromMilliseconds(1), |
| 409 base::TimeDelta::FromMinutes(1), | 411 base::TimeDelta::FromMinutes(1), |
| 410 100); | 412 100); |
| 411 } | 413 } |
| 412 | 414 |
| 413 const std::string& host = params_->host_and_port().host(); | 415 const std::string& host = params_->host_and_port().host(); |
| 414 bool is_google = host == "google.com" || | 416 bool is_google = |
| 415 (host.size() > 11 && | 417 host == "google.com" || |
| 416 host.rfind(".google.com") == host.size() - 11); | 418 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11); |
| 417 if (is_google) { | 419 if (is_google) { |
| 418 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2", | 420 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2", |
| 419 connect_duration, | 421 connect_duration, |
| 420 base::TimeDelta::FromMilliseconds(1), | 422 base::TimeDelta::FromMilliseconds(1), |
| 421 base::TimeDelta::FromMinutes(1), | 423 base::TimeDelta::FromMinutes(1), |
| 422 100); | 424 100); |
| 423 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { | 425 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { |
| 424 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" | 426 UMA_HISTOGRAM_CUSTOM_TIMES( |
| 425 "Resume_Handshake", | 427 "Net.SSL_Connection_Latency_Google_" |
| 426 connect_duration, | 428 "Resume_Handshake", |
| 427 base::TimeDelta::FromMilliseconds(1), | 429 connect_duration, |
| 428 base::TimeDelta::FromMinutes(1), | 430 base::TimeDelta::FromMilliseconds(1), |
| 429 100); | 431 base::TimeDelta::FromMinutes(1), |
| 432 100); |
| 430 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 433 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
| 431 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" | 434 UMA_HISTOGRAM_CUSTOM_TIMES( |
| 432 "Full_Handshake", | 435 "Net.SSL_Connection_Latency_Google_" |
| 433 connect_duration, | 436 "Full_Handshake", |
| 434 base::TimeDelta::FromMilliseconds(1), | 437 connect_duration, |
| 435 base::TimeDelta::FromMinutes(1), | 438 base::TimeDelta::FromMilliseconds(1), |
| 436 100); | 439 base::TimeDelta::FromMinutes(1), |
| 440 100); |
| 437 } | 441 } |
| 438 } | 442 } |
| 439 } | 443 } |
| 440 | 444 |
| 441 if (result == OK || IsCertificateError(result)) { | 445 if (result == OK || IsCertificateError(result)) { |
| 442 SetSocket(ssl_socket_.PassAs<StreamSocket>()); | 446 SetSocket(ssl_socket_.PassAs<StreamSocket>()); |
| 443 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 447 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 444 error_response_info_.cert_request_info = new SSLCertRequestInfo; | 448 error_response_info_.cert_request_info = new SSLCertRequestInfo; |
| 445 ssl_socket_->GetSSLCertRequestInfo( | 449 ssl_socket_->GetSSLCertRequestInfo( |
| 446 error_response_info_.cert_request_info.get()); | 450 error_response_info_.cert_request_info.get()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 pool_timeout = socks_pool_->ConnectionTimeout(); | 495 pool_timeout = socks_pool_->ConnectionTimeout(); |
| 492 if (pool_timeout > max_transport_timeout) | 496 if (pool_timeout > max_transport_timeout) |
| 493 max_transport_timeout = pool_timeout; | 497 max_transport_timeout = pool_timeout; |
| 494 } | 498 } |
| 495 if (http_proxy_pool_) { | 499 if (http_proxy_pool_) { |
| 496 pool_timeout = http_proxy_pool_->ConnectionTimeout(); | 500 pool_timeout = http_proxy_pool_->ConnectionTimeout(); |
| 497 if (pool_timeout > max_transport_timeout) | 501 if (pool_timeout > max_transport_timeout) |
| 498 max_transport_timeout = pool_timeout; | 502 max_transport_timeout = pool_timeout; |
| 499 } | 503 } |
| 500 timeout_ = max_transport_timeout + | 504 timeout_ = max_transport_timeout + |
| 501 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); | 505 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); |
| 502 } | 506 } |
| 503 | 507 |
| 504 SSLClientSocketPool::SSLClientSocketPool( | 508 SSLClientSocketPool::SSLClientSocketPool( |
| 505 int max_sockets, | 509 int max_sockets, |
| 506 int max_sockets_per_group, | 510 int max_sockets_per_group, |
| 507 ClientSocketPoolHistograms* histograms, | 511 ClientSocketPoolHistograms* histograms, |
| 508 HostResolver* host_resolver, | 512 HostResolver* host_resolver, |
| 509 CertVerifier* cert_verifier, | 513 CertVerifier* cert_verifier, |
| 510 ServerBoundCertService* server_bound_cert_service, | 514 ServerBoundCertService* server_bound_cert_service, |
| 511 TransportSecurityState* transport_security_state, | 515 TransportSecurityState* transport_security_state, |
| 512 CTVerifier* cert_transparency_verifier, | 516 CTVerifier* cert_transparency_verifier, |
| 513 const std::string& ssl_session_cache_shard, | 517 const std::string& ssl_session_cache_shard, |
| 514 ClientSocketFactory* client_socket_factory, | 518 ClientSocketFactory* client_socket_factory, |
| 515 TransportClientSocketPool* transport_pool, | 519 TransportClientSocketPool* transport_pool, |
| 516 SOCKSClientSocketPool* socks_pool, | 520 SOCKSClientSocketPool* socks_pool, |
| 517 HttpProxyClientSocketPool* http_proxy_pool, | 521 HttpProxyClientSocketPool* http_proxy_pool, |
| 518 SSLConfigService* ssl_config_service, | 522 SSLConfigService* ssl_config_service, |
| 519 NetLog* net_log) | 523 NetLog* net_log) |
| 520 : transport_pool_(transport_pool), | 524 : transport_pool_(transport_pool), |
| 521 socks_pool_(socks_pool), | 525 socks_pool_(socks_pool), |
| 522 http_proxy_pool_(http_proxy_pool), | 526 http_proxy_pool_(http_proxy_pool), |
| 523 base_(this, max_sockets, max_sockets_per_group, histograms, | 527 base_(this, |
| 528 max_sockets, |
| 529 max_sockets_per_group, |
| 530 histograms, |
| 524 ClientSocketPool::unused_idle_socket_timeout(), | 531 ClientSocketPool::unused_idle_socket_timeout(), |
| 525 ClientSocketPool::used_idle_socket_timeout(), | 532 ClientSocketPool::used_idle_socket_timeout(), |
| 526 new SSLConnectJobFactory(transport_pool, | 533 new SSLConnectJobFactory( |
| 527 socks_pool, | 534 transport_pool, |
| 528 http_proxy_pool, | 535 socks_pool, |
| 529 client_socket_factory, | 536 http_proxy_pool, |
| 530 host_resolver, | 537 client_socket_factory, |
| 531 SSLClientSocketContext( | 538 host_resolver, |
| 532 cert_verifier, | 539 SSLClientSocketContext(cert_verifier, |
| 533 server_bound_cert_service, | 540 server_bound_cert_service, |
| 534 transport_security_state, | 541 transport_security_state, |
| 535 cert_transparency_verifier, | 542 cert_transparency_verifier, |
| 536 ssl_session_cache_shard), | 543 ssl_session_cache_shard), |
| 537 net_log)), | 544 net_log)), |
| 538 ssl_config_service_(ssl_config_service) { | 545 ssl_config_service_(ssl_config_service) { |
| 539 if (ssl_config_service_.get()) | 546 if (ssl_config_service_.get()) |
| 540 ssl_config_service_->AddObserver(this); | 547 ssl_config_service_->AddObserver(this); |
| 541 if (transport_pool_) | 548 if (transport_pool_) |
| 542 base_.AddLowerLayeredPool(transport_pool_); | 549 base_.AddLowerLayeredPool(transport_pool_); |
| 543 if (socks_pool_) | 550 if (socks_pool_) |
| 544 base_.AddLowerLayeredPool(socks_pool_); | 551 base_.AddLowerLayeredPool(socks_pool_); |
| 545 if (http_proxy_pool_) | 552 if (http_proxy_pool_) |
| 546 base_.AddLowerLayeredPool(http_proxy_pool_); | 553 base_.AddLowerLayeredPool(http_proxy_pool_); |
| 547 } | 554 } |
| 548 | 555 |
| 549 SSLClientSocketPool::~SSLClientSocketPool() { | 556 SSLClientSocketPool::~SSLClientSocketPool() { |
| 550 if (ssl_config_service_.get()) | 557 if (ssl_config_service_.get()) |
| 551 ssl_config_service_->RemoveObserver(this); | 558 ssl_config_service_->RemoveObserver(this); |
| 552 } | 559 } |
| 553 | 560 |
| 554 scoped_ptr<ConnectJob> | 561 scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( |
| 555 SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob( | |
| 556 const std::string& group_name, | 562 const std::string& group_name, |
| 557 const PoolBase::Request& request, | 563 const PoolBase::Request& request, |
| 558 ConnectJob::Delegate* delegate) const { | 564 ConnectJob::Delegate* delegate) const { |
| 559 return scoped_ptr<ConnectJob>( | 565 return scoped_ptr<ConnectJob>(new SSLConnectJob(group_name, |
| 560 new SSLConnectJob(group_name, request.priority(), request.params(), | 566 request.priority(), |
| 561 ConnectionTimeout(), transport_pool_, socks_pool_, | 567 request.params(), |
| 562 http_proxy_pool_, client_socket_factory_, | 568 ConnectionTimeout(), |
| 563 host_resolver_, context_, delegate, net_log_)); | 569 transport_pool_, |
| 570 socks_pool_, |
| 571 http_proxy_pool_, |
| 572 client_socket_factory_, |
| 573 host_resolver_, |
| 574 context_, |
| 575 delegate, |
| 576 net_log_)); |
| 564 } | 577 } |
| 565 | 578 |
| 566 base::TimeDelta | 579 base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() |
| 567 SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout() const { | 580 const { |
| 568 return timeout_; | 581 return timeout_; |
| 569 } | 582 } |
| 570 | 583 |
| 571 int SSLClientSocketPool::RequestSocket(const std::string& group_name, | 584 int SSLClientSocketPool::RequestSocket(const std::string& group_name, |
| 572 const void* socket_params, | 585 const void* socket_params, |
| 573 RequestPriority priority, | 586 RequestPriority priority, |
| 574 ClientSocketHandle* handle, | 587 ClientSocketHandle* handle, |
| 575 const CompletionCallback& callback, | 588 const CompletionCallback& callback, |
| 576 const BoundNetLog& net_log) { | 589 const BoundNetLog& net_log) { |
| 577 const scoped_refptr<SSLSocketParams>* casted_socket_params = | 590 const scoped_refptr<SSLSocketParams>* casted_socket_params = |
| 578 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params); | 591 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params); |
| 579 | 592 |
| 580 return base_.RequestSocket(group_name, *casted_socket_params, priority, | 593 return base_.RequestSocket( |
| 581 handle, callback, net_log); | 594 group_name, *casted_socket_params, priority, handle, callback, net_log); |
| 582 } | 595 } |
| 583 | 596 |
| 584 void SSLClientSocketPool::RequestSockets( | 597 void SSLClientSocketPool::RequestSockets(const std::string& group_name, |
| 585 const std::string& group_name, | 598 const void* params, |
| 586 const void* params, | 599 int num_sockets, |
| 587 int num_sockets, | 600 const BoundNetLog& net_log) { |
| 588 const BoundNetLog& net_log) { | |
| 589 const scoped_refptr<SSLSocketParams>* casted_params = | 601 const scoped_refptr<SSLSocketParams>* casted_params = |
| 590 static_cast<const scoped_refptr<SSLSocketParams>*>(params); | 602 static_cast<const scoped_refptr<SSLSocketParams>*>(params); |
| 591 | 603 |
| 592 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); | 604 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); |
| 593 } | 605 } |
| 594 | 606 |
| 595 void SSLClientSocketPool::CancelRequest(const std::string& group_name, | 607 void SSLClientSocketPool::CancelRequest(const std::string& group_name, |
| 596 ClientSocketHandle* handle) { | 608 ClientSocketHandle* handle) { |
| 597 base_.CancelRequest(group_name, handle); | 609 base_.CancelRequest(group_name, handle); |
| 598 } | 610 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 614 int SSLClientSocketPool::IdleSocketCount() const { | 626 int SSLClientSocketPool::IdleSocketCount() const { |
| 615 return base_.idle_socket_count(); | 627 return base_.idle_socket_count(); |
| 616 } | 628 } |
| 617 | 629 |
| 618 int SSLClientSocketPool::IdleSocketCountInGroup( | 630 int SSLClientSocketPool::IdleSocketCountInGroup( |
| 619 const std::string& group_name) const { | 631 const std::string& group_name) const { |
| 620 return base_.IdleSocketCountInGroup(group_name); | 632 return base_.IdleSocketCountInGroup(group_name); |
| 621 } | 633 } |
| 622 | 634 |
| 623 LoadState SSLClientSocketPool::GetLoadState( | 635 LoadState SSLClientSocketPool::GetLoadState( |
| 624 const std::string& group_name, const ClientSocketHandle* handle) const { | 636 const std::string& group_name, |
| 637 const ClientSocketHandle* handle) const { |
| 625 return base_.GetLoadState(group_name, handle); | 638 return base_.GetLoadState(group_name, handle); |
| 626 } | 639 } |
| 627 | 640 |
| 628 base::DictionaryValue* SSLClientSocketPool::GetInfoAsValue( | 641 base::DictionaryValue* SSLClientSocketPool::GetInfoAsValue( |
| 629 const std::string& name, | 642 const std::string& name, |
| 630 const std::string& type, | 643 const std::string& type, |
| 631 bool include_nested_pools) const { | 644 bool include_nested_pools) const { |
| 632 base::DictionaryValue* dict = base_.GetInfoAsValue(name, type); | 645 base::DictionaryValue* dict = base_.GetInfoAsValue(name, type); |
| 633 if (include_nested_pools) { | 646 if (include_nested_pools) { |
| 634 base::ListValue* list = new base::ListValue(); | 647 base::ListValue* list = new base::ListValue(); |
| 635 if (transport_pool_) { | 648 if (transport_pool_) { |
| 636 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", | 649 list->Append(transport_pool_->GetInfoAsValue( |
| 637 "transport_socket_pool", | 650 "transport_socket_pool", "transport_socket_pool", false)); |
| 638 false)); | |
| 639 } | 651 } |
| 640 if (socks_pool_) { | 652 if (socks_pool_) { |
| 641 list->Append(socks_pool_->GetInfoAsValue("socks_pool", | 653 list->Append( |
| 642 "socks_pool", | 654 socks_pool_->GetInfoAsValue("socks_pool", "socks_pool", true)); |
| 643 true)); | |
| 644 } | 655 } |
| 645 if (http_proxy_pool_) { | 656 if (http_proxy_pool_) { |
| 646 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool", | 657 list->Append(http_proxy_pool_->GetInfoAsValue( |
| 647 "http_proxy_pool", | 658 "http_proxy_pool", "http_proxy_pool", true)); |
| 648 true)); | |
| 649 } | 659 } |
| 650 dict->Set("nested_pools", list); | 660 dict->Set("nested_pools", list); |
| 651 } | 661 } |
| 652 return dict; | 662 return dict; |
| 653 } | 663 } |
| 654 | 664 |
| 655 base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const { | 665 base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const { |
| 656 return base_.ConnectionTimeout(); | 666 return base_.ConnectionTimeout(); |
| 657 } | 667 } |
| 658 | 668 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 677 if (base_.CloseOneIdleSocket()) | 687 if (base_.CloseOneIdleSocket()) |
| 678 return true; | 688 return true; |
| 679 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 689 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 680 } | 690 } |
| 681 | 691 |
| 682 void SSLClientSocketPool::OnSSLConfigChanged() { | 692 void SSLClientSocketPool::OnSSLConfigChanged() { |
| 683 FlushWithError(ERR_NETWORK_CHANGED); | 693 FlushWithError(ERR_NETWORK_CHANGED); |
| 684 } | 694 } |
| 685 | 695 |
| 686 } // namespace net | 696 } // namespace net |
| OLD | NEW |