diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 20:26:13 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 20:26:13 +0000 |
commit | 2431756ea7ceea7ac837522d948c3628cf83b647 (patch) | |
tree | 89e8921ce9f257f2dfeeb2491fb0ea246d4d1050 /net/http/http_proxy_client_socket_pool.cc | |
parent | 252c50a4cdb5a9506938b231f4bd19afd5365757 (diff) | |
download | chromium_src-2431756ea7ceea7ac837522d948c3628cf83b647.zip chromium_src-2431756ea7ceea7ac837522d948c3628cf83b647.tar.gz chromium_src-2431756ea7ceea7ac837522d948c3628cf83b647.tar.bz2 |
Stop refcounting ClientSocketPool.
Establishes that HttpNetworkSession owns all the socket pools.
Move out all the socket pools into a ClientSocketPoolManager. This is because
of the dependency tree amongst socket pools, which dictates the order in which
they must be constructed and destructed. In order to better establish it, I
moved them out to their own class. HttpNetworkSession owns the
ClientSocketPoolManager which owns the pools. We pass the pools as raw
pointers everywhere.
Note that ClientSocketPoolManager owns more pools than are publicly accessible via its interface. That's because some of them are wrapped by publicly exposed pools.
Also, ClientSocketPoolHistograms used to be reference counted. That's because it can be shared by multiple ClientSocketPools. But it's effectively a global as well, so I make their lifetimes persist for the length of ClientSocketPoolManager too.
I also removed internal refcounting in ClientSocketPoolBase. I had refcounted
it before I knew about ScopedRunnableMethodFactory back when I first started.
I cleaned up the unit tests a lot. Back when I was a young padawan, I didn't
really know what I was doing, so I copy/pasted a metric asston of code. Turns
out most of it was stupid, so I fixed it. I also stopped the use of
implementation inheritance with ClientSocketPoolTest because it's discouraged
by the style guide and more importantly because it caused the
ClientSocketHandles within the TestSocketRequest vector to be destroyed _after_
the pools themselves were destroyed, which is bad since the handles will call
pool_->Release() which blows up.
BUG=56215,56215
TEST=Existing unit tests
Review URL: http://codereview.chromium.org/3389020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60983 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_proxy_client_socket_pool.cc')
-rw-r--r-- | net/http/http_proxy_client_socket_pool.cc | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 16f9597..fa49944 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -16,8 +16,9 @@ #include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_handle.h" #include "net/socket/client_socket_pool_base.h" -#include "net/socket/tcp_client_socket_pool.h" #include "net/socket/ssl_client_socket.h" +#include "net/socket/ssl_client_socket_pool.h" +#include "net/socket/tcp_client_socket_pool.h" namespace net { @@ -59,8 +60,8 @@ HttpProxyConnectJob::HttpProxyConnectJob( const std::string& group_name, const scoped_refptr<HttpProxySocketParams>& params, const base::TimeDelta& timeout_duration, - const scoped_refptr<TCPClientSocketPool>& tcp_pool, - const scoped_refptr<SSLClientSocketPool>& ssl_pool, + TCPClientSocketPool* tcp_pool, + SSLClientSocketPool* ssl_pool, const scoped_refptr<HostResolver>& host_resolver, Delegate* delegate, NetLog* net_log) @@ -237,8 +238,8 @@ int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { HttpProxyClientSocketPool:: HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( - const scoped_refptr<TCPClientSocketPool>& tcp_pool, - const scoped_refptr<SSLClientSocketPool>& ssl_pool, + TCPClientSocketPool* tcp_pool, + SSLClientSocketPool* ssl_pool, HostResolver* host_resolver, NetLog* net_log) : tcp_pool_(tcp_pool), @@ -269,10 +270,10 @@ HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob( HttpProxyClientSocketPool::HttpProxyClientSocketPool( int max_sockets, int max_sockets_per_group, - const scoped_refptr<ClientSocketPoolHistograms>& histograms, + ClientSocketPoolHistograms* histograms, const scoped_refptr<HostResolver>& host_resolver, - const scoped_refptr<TCPClientSocketPool>& tcp_pool, - const scoped_refptr<SSLClientSocketPool>& ssl_pool, + TCPClientSocketPool* tcp_pool, + SSLClientSocketPool* ssl_pool, NetLog* net_log) : tcp_pool_(tcp_pool), ssl_pool_(ssl_pool), @@ -311,10 +312,6 @@ void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, void HttpProxyClientSocketPool::Flush() { base_.Flush(); - if (ssl_pool_) - ssl_pool_->Flush(); - if (tcp_pool_) - tcp_pool_->Flush(); } void HttpProxyClientSocketPool::CloseIdleSockets() { @@ -338,12 +335,12 @@ DictionaryValue* HttpProxyClientSocketPool::GetInfoAsValue( DictionaryValue* dict = base_.GetInfoAsValue(name, type); if (include_nested_pools) { ListValue* list = new ListValue(); - if (tcp_pool_.get()) { + if (tcp_pool_) { list->Append(tcp_pool_->GetInfoAsValue("tcp_socket_pool", "tcp_socket_pool", true)); } - if (ssl_pool_.get()) { + if (ssl_pool_) { list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", "ssl_socket_pool", true)); |