diff options
Diffstat (limited to 'net/http/http_network_session.cc')
-rw-r--r-- | net/http/http_network_session.cc | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index e49674b..971786a 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -44,18 +44,21 @@ HttpNetworkSession::HttpNetworkSession( HttpAuthHandlerFactory* http_auth_handler_factory, HttpNetworkDelegate* network_delegate, NetLog* net_log) - // TODO(vandebo) when we've completely converted to pools, the base TCP - // pool name should get changed to TCP instead of Transport. - : tcp_pool_histograms_(new ClientSocketPoolHistograms("Transport")), + : tcp_pool_histograms_(new ClientSocketPoolHistograms("TCP")), tcp_for_http_proxy_pool_histograms_( new ClientSocketPoolHistograms("TCPforHTTPProxy")), http_proxy_pool_histograms_(new ClientSocketPoolHistograms("HTTPProxy")), tcp_for_socks_pool_histograms_( new ClientSocketPoolHistograms("TCPforSOCKS")), socks_pool_histograms_(new ClientSocketPoolHistograms("SOCK")), - tcp_socket_pool_(new TCPClientSocketPool(g_max_sockets, - g_max_sockets_per_group, tcp_pool_histograms_, host_resolver, - client_socket_factory, net_log)), + ssl_pool_histograms_(new ClientSocketPoolHistograms("SSL")), + tcp_socket_pool_(new TCPClientSocketPool( + g_max_sockets, g_max_sockets_per_group, tcp_pool_histograms_, + host_resolver, client_socket_factory, net_log)), + ssl_socket_pool_(new SSLClientSocketPool( + g_max_sockets, g_max_sockets_per_group, ssl_pool_histograms_, + host_resolver, client_socket_factory, tcp_socket_pool_, NULL, + NULL, net_log)), socket_factory_(client_socket_factory), host_resolver_(host_resolver), proxy_service_(proxy_service), @@ -74,12 +77,12 @@ HttpNetworkSession::~HttpNetworkSession() { const scoped_refptr<HttpProxyClientSocketPool>& HttpNetworkSession::GetSocketPoolForHTTPProxy(const HostPortPair& http_proxy) { HTTPProxySocketPoolMap::const_iterator it = - http_proxy_socket_pool_.find(http_proxy); - if (it != http_proxy_socket_pool_.end()) + http_proxy_socket_pools_.find(http_proxy); + if (it != http_proxy_socket_pools_.end()) return it->second; std::pair<HTTPProxySocketPoolMap::iterator, bool> ret = - http_proxy_socket_pool_.insert( + http_proxy_socket_pools_.insert( std::make_pair( http_proxy, new HttpProxyClientSocketPool( @@ -97,18 +100,42 @@ HttpNetworkSession::GetSocketPoolForHTTPProxy(const HostPortPair& http_proxy) { const scoped_refptr<SOCKSClientSocketPool>& HttpNetworkSession::GetSocketPoolForSOCKSProxy( const HostPortPair& socks_proxy) { - SOCKSSocketPoolMap::const_iterator it = socks_socket_pool_.find(socks_proxy); - if (it != socks_socket_pool_.end()) + SOCKSSocketPoolMap::const_iterator it = socks_socket_pools_.find(socks_proxy); + if (it != socks_socket_pools_.end()) return it->second; - std::pair<SOCKSSocketPoolMap::iterator, bool> ret = socks_socket_pool_.insert( - std::make_pair(socks_proxy, new SOCKSClientSocketPool( - g_max_sockets_per_proxy_server, g_max_sockets_per_group, - socks_pool_histograms_, host_resolver_, - new TCPClientSocketPool(g_max_sockets_per_proxy_server, - g_max_sockets_per_group, tcp_for_socks_pool_histograms_, - host_resolver_, socket_factory_, net_log_), - net_log_))); + std::pair<SOCKSSocketPoolMap::iterator, bool> ret = + socks_socket_pools_.insert( + std::make_pair(socks_proxy, new SOCKSClientSocketPool( + g_max_sockets_per_proxy_server, g_max_sockets_per_group, + socks_pool_histograms_, host_resolver_, + new TCPClientSocketPool(g_max_sockets_per_proxy_server, + g_max_sockets_per_group, tcp_for_socks_pool_histograms_, + host_resolver_, socket_factory_, net_log_), + net_log_))); + + return ret.first->second; +} + +const scoped_refptr<SSLClientSocketPool>& +HttpNetworkSession::GetSocketPoolForSSLWithProxy( + const HostPortPair& proxy_server) { + SSLSocketPoolMap::const_iterator it = + ssl_socket_pools_for_proxies_.find(proxy_server); + if (it != ssl_socket_pools_for_proxies_.end()) + return it->second; + + SSLClientSocketPool* new_pool = new SSLClientSocketPool( + g_max_sockets_per_proxy_server, g_max_sockets_per_group, + ssl_pool_histograms_, host_resolver_, socket_factory_, + NULL, + GetSocketPoolForHTTPProxy(proxy_server), + GetSocketPoolForSOCKSProxy(proxy_server), + net_log_); + + std::pair<SSLSocketPoolMap::iterator, bool> ret = + ssl_socket_pools_for_proxies_.insert(std::make_pair(proxy_server, + new_pool)); return ret.first->second; } |