| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 int SSLConnectJob::ConnectInternal() { | 584 int SSLConnectJob::ConnectInternal() { |
| 585 next_state_ = GetInitialState(params_->GetConnectionType()); | 585 next_state_ = GetInitialState(params_->GetConnectionType()); |
| 586 return DoLoop(OK); | 586 return DoLoop(OK); |
| 587 } | 587 } |
| 588 | 588 |
| 589 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory( | 589 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory( |
| 590 TransportClientSocketPool* transport_pool, | 590 TransportClientSocketPool* transport_pool, |
| 591 SOCKSClientSocketPool* socks_pool, | 591 SOCKSClientSocketPool* socks_pool, |
| 592 HttpProxyClientSocketPool* http_proxy_pool, | 592 HttpProxyClientSocketPool* http_proxy_pool, |
| 593 ClientSocketFactory* client_socket_factory, | 593 ClientSocketFactory* client_socket_factory, |
| 594 HostResolver* host_resolver, | |
| 595 const SSLClientSocketContext& context, | 594 const SSLClientSocketContext& context, |
| 596 const SSLConnectJob::GetMessengerCallback& get_messenger_callback, | 595 const SSLConnectJob::GetMessengerCallback& get_messenger_callback, |
| 597 NetLog* net_log) | 596 NetLog* net_log) |
| 598 : transport_pool_(transport_pool), | 597 : transport_pool_(transport_pool), |
| 599 socks_pool_(socks_pool), | 598 socks_pool_(socks_pool), |
| 600 http_proxy_pool_(http_proxy_pool), | 599 http_proxy_pool_(http_proxy_pool), |
| 601 client_socket_factory_(client_socket_factory), | 600 client_socket_factory_(client_socket_factory), |
| 602 host_resolver_(host_resolver), | |
| 603 context_(context), | 601 context_(context), |
| 604 get_messenger_callback_(get_messenger_callback), | 602 get_messenger_callback_(get_messenger_callback), |
| 605 net_log_(net_log) { | 603 net_log_(net_log) { |
| 606 base::TimeDelta max_transport_timeout = base::TimeDelta(); | 604 base::TimeDelta max_transport_timeout = base::TimeDelta(); |
| 607 base::TimeDelta pool_timeout; | 605 base::TimeDelta pool_timeout; |
| 608 if (transport_pool_) | 606 if (transport_pool_) |
| 609 max_transport_timeout = transport_pool_->ConnectionTimeout(); | 607 max_transport_timeout = transport_pool_->ConnectionTimeout(); |
| 610 if (socks_pool_) { | 608 if (socks_pool_) { |
| 611 pool_timeout = socks_pool_->ConnectionTimeout(); | 609 pool_timeout = socks_pool_->ConnectionTimeout(); |
| 612 if (pool_timeout > max_transport_timeout) | 610 if (pool_timeout > max_transport_timeout) |
| 613 max_transport_timeout = pool_timeout; | 611 max_transport_timeout = pool_timeout; |
| 614 } | 612 } |
| 615 if (http_proxy_pool_) { | 613 if (http_proxy_pool_) { |
| 616 pool_timeout = http_proxy_pool_->ConnectionTimeout(); | 614 pool_timeout = http_proxy_pool_->ConnectionTimeout(); |
| 617 if (pool_timeout > max_transport_timeout) | 615 if (pool_timeout > max_transport_timeout) |
| 618 max_transport_timeout = pool_timeout; | 616 max_transport_timeout = pool_timeout; |
| 619 } | 617 } |
| 620 timeout_ = max_transport_timeout + | 618 timeout_ = max_transport_timeout + |
| 621 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); | 619 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); |
| 622 } | 620 } |
| 623 | 621 |
| 624 SSLClientSocketPool::SSLConnectJobFactory::~SSLConnectJobFactory() { | 622 SSLClientSocketPool::SSLConnectJobFactory::~SSLConnectJobFactory() { |
| 625 } | 623 } |
| 626 | 624 |
| 627 SSLClientSocketPool::SSLClientSocketPool( | 625 SSLClientSocketPool::SSLClientSocketPool( |
| 628 int max_sockets, | 626 int max_sockets, |
| 629 int max_sockets_per_group, | 627 int max_sockets_per_group, |
| 630 ClientSocketPoolHistograms* histograms, | 628 ClientSocketPoolHistograms* histograms, |
| 631 HostResolver* host_resolver, | |
| 632 CertVerifier* cert_verifier, | 629 CertVerifier* cert_verifier, |
| 633 ChannelIDService* channel_id_service, | 630 ChannelIDService* channel_id_service, |
| 634 TransportSecurityState* transport_security_state, | 631 TransportSecurityState* transport_security_state, |
| 635 CTVerifier* cert_transparency_verifier, | 632 CTVerifier* cert_transparency_verifier, |
| 636 CertPolicyEnforcer* cert_policy_enforcer, | 633 CertPolicyEnforcer* cert_policy_enforcer, |
| 637 const std::string& ssl_session_cache_shard, | 634 const std::string& ssl_session_cache_shard, |
| 638 ClientSocketFactory* client_socket_factory, | 635 ClientSocketFactory* client_socket_factory, |
| 639 TransportClientSocketPool* transport_pool, | 636 TransportClientSocketPool* transport_pool, |
| 640 SOCKSClientSocketPool* socks_pool, | 637 SOCKSClientSocketPool* socks_pool, |
| 641 HttpProxyClientSocketPool* http_proxy_pool, | 638 HttpProxyClientSocketPool* http_proxy_pool, |
| 642 SSLConfigService* ssl_config_service, | 639 SSLConfigService* ssl_config_service, |
| 643 bool enable_ssl_connect_job_waiting, | 640 bool enable_ssl_connect_job_waiting, |
| 644 NetLog* net_log) | 641 NetLog* net_log) |
| 645 : transport_pool_(transport_pool), | 642 : transport_pool_(transport_pool), |
| 646 socks_pool_(socks_pool), | 643 socks_pool_(socks_pool), |
| 647 http_proxy_pool_(http_proxy_pool), | 644 http_proxy_pool_(http_proxy_pool), |
| 648 base_(this, | 645 base_(this, |
| 649 max_sockets, | 646 max_sockets, |
| 650 max_sockets_per_group, | 647 max_sockets_per_group, |
| 651 histograms, | 648 histograms, |
| 652 ClientSocketPool::unused_idle_socket_timeout(), | 649 ClientSocketPool::unused_idle_socket_timeout(), |
| 653 ClientSocketPool::used_idle_socket_timeout(), | 650 ClientSocketPool::used_idle_socket_timeout(), |
| 654 new SSLConnectJobFactory( | 651 new SSLConnectJobFactory( |
| 655 transport_pool, | 652 transport_pool, |
| 656 socks_pool, | 653 socks_pool, |
| 657 http_proxy_pool, | 654 http_proxy_pool, |
| 658 client_socket_factory, | 655 client_socket_factory, |
| 659 host_resolver, | |
| 660 SSLClientSocketContext(cert_verifier, | 656 SSLClientSocketContext(cert_verifier, |
| 661 channel_id_service, | 657 channel_id_service, |
| 662 transport_security_state, | 658 transport_security_state, |
| 663 cert_transparency_verifier, | 659 cert_transparency_verifier, |
| 664 cert_policy_enforcer, | 660 cert_policy_enforcer, |
| 665 ssl_session_cache_shard), | 661 ssl_session_cache_shard), |
| 666 base::Bind( | 662 base::Bind( |
| 667 &SSLClientSocketPool::GetOrCreateSSLConnectJobMessenger, | 663 &SSLClientSocketPool::GetOrCreateSSLConnectJobMessenger, |
| 668 base::Unretained(this)), | 664 base::Unretained(this)), |
| 669 net_log)), | 665 net_log)), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 CHECK(it != messenger_map_.end()); | 840 CHECK(it != messenger_map_.end()); |
| 845 delete it->second; | 841 delete it->second; |
| 846 messenger_map_.erase(it); | 842 messenger_map_.erase(it); |
| 847 } | 843 } |
| 848 | 844 |
| 849 void SSLClientSocketPool::OnSSLConfigChanged() { | 845 void SSLClientSocketPool::OnSSLConfigChanged() { |
| 850 FlushWithError(ERR_NETWORK_CHANGED); | 846 FlushWithError(ERR_NETWORK_CHANGED); |
| 851 } | 847 } |
| 852 | 848 |
| 853 } // namespace net | 849 } // namespace net |
| OLD | NEW |