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