| 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/client_socket_pool_manager_impl.h" | 5 #include "net/socket/client_socket_pool_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "net/http/http_network_session.h" | 9 #include "net/http/http_network_session.h" |
| 10 #include "net/http/http_proxy_client_socket_pool.h" | 10 #include "net/http/http_proxy_client_socket_pool.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ClientSocketFactory* socket_factory, | 39 ClientSocketFactory* socket_factory, |
| 40 HostResolver* host_resolver, | 40 HostResolver* host_resolver, |
| 41 CertVerifier* cert_verifier, | 41 CertVerifier* cert_verifier, |
| 42 ChannelIDService* channel_id_service, | 42 ChannelIDService* channel_id_service, |
| 43 TransportSecurityState* transport_security_state, | 43 TransportSecurityState* transport_security_state, |
| 44 CTVerifier* cert_transparency_verifier, | 44 CTVerifier* cert_transparency_verifier, |
| 45 const std::string& ssl_session_cache_shard, | 45 const std::string& ssl_session_cache_shard, |
| 46 ProxyService* proxy_service, | 46 ProxyService* proxy_service, |
| 47 SSLConfigService* ssl_config_service, | 47 SSLConfigService* ssl_config_service, |
| 48 bool enable_ssl_connect_job_waiting, | 48 bool enable_ssl_connect_job_waiting, |
| 49 ProxyDelegate* proxy_delegate, |
| 49 HttpNetworkSession::SocketPoolType pool_type) | 50 HttpNetworkSession::SocketPoolType pool_type) |
| 50 : net_log_(net_log), | 51 : net_log_(net_log), |
| 51 socket_factory_(socket_factory), | 52 socket_factory_(socket_factory), |
| 52 host_resolver_(host_resolver), | 53 host_resolver_(host_resolver), |
| 53 cert_verifier_(cert_verifier), | 54 cert_verifier_(cert_verifier), |
| 54 channel_id_service_(channel_id_service), | 55 channel_id_service_(channel_id_service), |
| 55 transport_security_state_(transport_security_state), | 56 transport_security_state_(transport_security_state), |
| 56 cert_transparency_verifier_(cert_transparency_verifier), | 57 cert_transparency_verifier_(cert_transparency_verifier), |
| 57 ssl_session_cache_shard_(ssl_session_cache_shard), | 58 ssl_session_cache_shard_(ssl_session_cache_shard), |
| 58 proxy_service_(proxy_service), | 59 proxy_service_(proxy_service), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 NULL /* no http proxy */, | 92 NULL /* no http proxy */, |
| 92 ssl_config_service, | 93 ssl_config_service, |
| 93 enable_ssl_connect_job_waiting, | 94 enable_ssl_connect_job_waiting, |
| 94 net_log)), | 95 net_log)), |
| 95 transport_for_socks_pool_histograms_("TCPforSOCKS"), | 96 transport_for_socks_pool_histograms_("TCPforSOCKS"), |
| 96 socks_pool_histograms_("SOCK"), | 97 socks_pool_histograms_("SOCK"), |
| 97 transport_for_http_proxy_pool_histograms_("TCPforHTTPProxy"), | 98 transport_for_http_proxy_pool_histograms_("TCPforHTTPProxy"), |
| 98 transport_for_https_proxy_pool_histograms_("TCPforHTTPSProxy"), | 99 transport_for_https_proxy_pool_histograms_("TCPforHTTPSProxy"), |
| 99 ssl_for_https_proxy_pool_histograms_("SSLforHTTPSProxy"), | 100 ssl_for_https_proxy_pool_histograms_("SSLforHTTPSProxy"), |
| 100 http_proxy_pool_histograms_("HTTPProxy"), | 101 http_proxy_pool_histograms_("HTTPProxy"), |
| 101 ssl_socket_pool_for_proxies_histograms_("SSLForProxies") { | 102 ssl_socket_pool_for_proxies_histograms_("SSLForProxies"), |
| 103 proxy_delegate_(proxy_delegate) { |
| 102 CertDatabase::GetInstance()->AddObserver(this); | 104 CertDatabase::GetInstance()->AddObserver(this); |
| 103 } | 105 } |
| 104 | 106 |
| 105 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { | 107 ClientSocketPoolManagerImpl::~ClientSocketPoolManagerImpl() { |
| 106 CertDatabase::GetInstance()->RemoveObserver(this); | 108 CertDatabase::GetInstance()->RemoveObserver(this); |
| 107 } | 109 } |
| 108 | 110 |
| 109 void ClientSocketPoolManagerImpl::FlushSocketPoolsWithError(int error) { | 111 void ClientSocketPoolManagerImpl::FlushSocketPoolsWithError(int error) { |
| 110 // Flush the highest level pools first, since higher level pools may release | 112 // Flush the highest level pools first, since higher level pools may release |
| 111 // stuff to the lower level pools. | 113 // stuff to the lower level pools. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 http_proxy_socket_pools_.insert( | 319 http_proxy_socket_pools_.insert( |
| 318 std::make_pair( | 320 std::make_pair( |
| 319 http_proxy, | 321 http_proxy, |
| 320 new HttpProxyClientSocketPool( | 322 new HttpProxyClientSocketPool( |
| 321 max_sockets_per_proxy_server(pool_type_), | 323 max_sockets_per_proxy_server(pool_type_), |
| 322 max_sockets_per_group(pool_type_), | 324 max_sockets_per_group(pool_type_), |
| 323 &http_proxy_pool_histograms_, | 325 &http_proxy_pool_histograms_, |
| 324 host_resolver_, | 326 host_resolver_, |
| 325 tcp_http_ret.first->second, | 327 tcp_http_ret.first->second, |
| 326 ssl_https_ret.first->second, | 328 ssl_https_ret.first->second, |
| 329 proxy_delegate_, |
| 327 net_log_))); | 330 net_log_))); |
| 328 | 331 |
| 329 return ret.first->second; | 332 return ret.first->second; |
| 330 } | 333 } |
| 331 | 334 |
| 332 SSLClientSocketPool* ClientSocketPoolManagerImpl::GetSocketPoolForSSLWithProxy( | 335 SSLClientSocketPool* ClientSocketPoolManagerImpl::GetSocketPoolForSSLWithProxy( |
| 333 const HostPortPair& proxy_server) { | 336 const HostPortPair& proxy_server) { |
| 334 SSLSocketPoolMap::const_iterator it = | 337 SSLSocketPoolMap::const_iterator it = |
| 335 ssl_socket_pools_for_proxies_.find(proxy_server); | 338 ssl_socket_pools_for_proxies_.find(proxy_server); |
| 336 if (it != ssl_socket_pools_for_proxies_.end()) | 339 if (it != ssl_socket_pools_for_proxies_.end()) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // We should not flush the socket pools if we added trust to a | 406 // We should not flush the socket pools if we added trust to a |
| 404 // cert. | 407 // cert. |
| 405 // | 408 // |
| 406 // Since the OnCACertChanged method doesn't tell us what | 409 // Since the OnCACertChanged method doesn't tell us what |
| 407 // kind of change it is, we have to flush the socket | 410 // kind of change it is, we have to flush the socket |
| 408 // pools to be safe. | 411 // pools to be safe. |
| 409 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); | 412 FlushSocketPoolsWithError(ERR_NETWORK_CHANGED); |
| 410 } | 413 } |
| 411 | 414 |
| 412 } // namespace net | 415 } // namespace net |
| OLD | NEW |