diff options
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/client_socket_pool.h | 13 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.cc | 2 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.h | 7 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 5 | ||||
-rw-r--r-- | net/socket/socks_client_socket_pool.cc | 19 | ||||
-rw-r--r-- | net/socket/socks_client_socket_pool.h | 8 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool.cc | 33 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool.h | 10 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool.h | 5 |
9 files changed, 79 insertions, 23 deletions
diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index c748bba..2a14266 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h @@ -18,7 +18,7 @@ #include "net/base/load_states.h" #include "net/base/request_priority.h" -class Value; +class DictionaryValue; namespace net { @@ -105,10 +105,13 @@ class ClientSocketPool : public base::RefCounted<ClientSocketPool> { virtual LoadState GetLoadState(const std::string& group_name, const ClientSocketHandle* handle) const = 0; - // Retrieves information on the current state of the pool as a Value. Caller - // takes possession of the returned value. - virtual Value* GetInfoAsValue(const std::string& name, - const std::string& type) const = 0; + // Retrieves information on the current state of the pool as a + // DictionaryValue. Caller takes possession of the returned value. + // If |include_nested_pools| is true, the states of any nested + // ClientSocketPools will be included. + virtual DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type, + bool include_nested_pools) const = 0; // Returns the maximum amount of time to wait before retrying a connect. static const int kMaxConnectRetryIntervalMs = 250; diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index b982aa0..45ce13a 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -401,7 +401,7 @@ LoadState ClientSocketPoolBaseHelper::GetLoadState( return LOAD_STATE_IDLE; } -Value* ClientSocketPoolBaseHelper::GetInfoAsValue( +DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue( const std::string& name, const std::string& type) const { DictionaryValue* dict = new DictionaryValue(); dict->SetString("name", name); diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 11540b2..69bb904 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -238,7 +238,8 @@ class ClientSocketPoolBaseHelper void CleanupIdleSockets(bool force); // See ClientSocketPool::GetInfoAsValue for documentation on this function. - Value* GetInfoAsValue(const std::string& name, const std::string& type) const; + DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type) const; base::TimeDelta ConnectionTimeout() const { return connect_job_factory_->ConnectionTimeout(); @@ -605,8 +606,8 @@ class ClientSocketPoolBase { return helper_->CleanupIdleSockets(force); } - Value* GetInfoAsValue(const std::string& name, - const std::string& type) const { + DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type) const { return helper_->GetInfoAsValue(name, type); } diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index b196168..9d52cf7 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -412,8 +412,9 @@ class TestClientSocketPool : public ClientSocketPool { return base_.GetLoadState(group_name, handle); } - virtual Value* GetInfoAsValue(const std::string& name, - const std::string& type) const { + virtual DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type, + bool include_nested_pools) const { return base_.GetInfoAsValue(name, type); } diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index e97d91e..7ed3f93 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -5,6 +5,7 @@ #include "net/socket/socks_client_socket_pool.h" #include "base/time.h" +#include "base/values.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/socket/client_socket_factory.h" @@ -183,7 +184,8 @@ SOCKSClientSocketPool::SOCKSClientSocketPool( const scoped_refptr<HostResolver>& host_resolver, const scoped_refptr<TCPClientSocketPool>& tcp_pool, NetLog* net_log) - : base_(max_sockets, max_sockets_per_group, histograms, + : tcp_pool_(tcp_pool), + base_(max_sockets, max_sockets_per_group, histograms, base::TimeDelta::FromSeconds( ClientSocketPool::unused_idle_socket_timeout()), base::TimeDelta::FromSeconds(kUsedIdleSocketTimeout), @@ -233,4 +235,19 @@ LoadState SOCKSClientSocketPool::GetLoadState( return base_.GetLoadState(group_name, handle); } +DictionaryValue* SOCKSClientSocketPool::GetInfoAsValue( + const std::string& name, + const std::string& type, + bool include_nested_pools) const { + DictionaryValue* dict = base_.GetInfoAsValue(name, type); + if (include_nested_pools) { + ListValue* list = new ListValue(); + list->Append(tcp_pool_->GetInfoAsValue("tcp_socket_pool", + "tcp_socket_pool", + false)); + dict->Set("nested_pools", list); + } + return dict; +} + } // namespace net diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h index 418d38c..0bea2cc 100644 --- a/net/socket/socks_client_socket_pool.h +++ b/net/socket/socks_client_socket_pool.h @@ -140,10 +140,9 @@ class SOCKSClientSocketPool : public ClientSocketPool { virtual LoadState GetLoadState(const std::string& group_name, const ClientSocketHandle* handle) const; - virtual Value* GetInfoAsValue(const std::string& name, - const std::string& type) const { - return base_.GetInfoAsValue(name, type); - } + virtual DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type, + bool include_nested_pools) const; virtual base::TimeDelta ConnectionTimeout() const { return base_.ConnectionTimeout(); @@ -186,6 +185,7 @@ class SOCKSClientSocketPool : public ClientSocketPool { DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJobFactory); }; + const scoped_refptr<TCPClientSocketPool> tcp_pool_; PoolBase base_; DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 94dcd1d..98fa93c 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -4,6 +4,7 @@ #include "net/socket/ssl_client_socket_pool.h" +#include "base/values.h" #include "net/base/dnsrr_resolver.h" #include "net/base/dns_util.h" #include "net/base/net_errors.h" @@ -447,7 +448,10 @@ SSLClientSocketPool::SSLClientSocketPool( const scoped_refptr<SOCKSClientSocketPool>& socks_pool, SSLConfigService* ssl_config_service, NetLog* net_log) - : base_(max_sockets, max_sockets_per_group, histograms, + : tcp_pool_(tcp_pool), + http_proxy_pool_(http_proxy_pool), + socks_pool_(socks_pool), + base_(max_sockets, max_sockets_per_group, histograms, base::TimeDelta::FromSeconds( ClientSocketPool::unused_idle_socket_timeout()), base::TimeDelta::FromSeconds(kUsedIdleSocketTimeout), @@ -509,4 +513,31 @@ void SSLClientSocketPool::OnSSLConfigChanged() { Flush(); } +DictionaryValue* SSLClientSocketPool::GetInfoAsValue( + const std::string& name, + const std::string& type, + bool include_nested_pools) const { + DictionaryValue* dict = base_.GetInfoAsValue(name, type); + if (include_nested_pools) { + ListValue* list = new ListValue(); + if (tcp_pool_.get()) { + list->Append(tcp_pool_->GetInfoAsValue("tcp_socket_pool", + "tcp_socket_pool", + false)); + } + if (http_proxy_pool_.get()) { + list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool", + "http_proxy_pool", + true)); + } + if (socks_pool_.get()) { + list->Append(socks_pool_->GetInfoAsValue("socks_pool", + "socks_pool", + true)); + } + dict->Set("nested_pools", list); + } + return dict; +} + } // namespace net diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index 6080f70..7a2054b 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h @@ -211,10 +211,9 @@ class SSLClientSocketPool : public ClientSocketPool, virtual LoadState GetLoadState(const std::string& group_name, const ClientSocketHandle* handle) const; - virtual Value* GetInfoAsValue(const std::string& name, - const std::string& type) const { - return base_.GetInfoAsValue(name, type); - } + virtual DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type, + bool include_nested_pools) const; virtual base::TimeDelta ConnectionTimeout() const { return base_.ConnectionTimeout(); @@ -268,6 +267,9 @@ class SSLClientSocketPool : public ClientSocketPool, DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); }; + const scoped_refptr<TCPClientSocketPool> tcp_pool_; + const scoped_refptr<HttpProxyClientSocketPool> http_proxy_pool_; + const scoped_refptr<SOCKSClientSocketPool> socks_pool_; PoolBase base_; const scoped_refptr<SSLConfigService> ssl_config_service_; diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h index 132f0e2..33eaaed 100644 --- a/net/socket/tcp_client_socket_pool.h +++ b/net/socket/tcp_client_socket_pool.h @@ -149,8 +149,9 @@ class TCPClientSocketPool : public ClientSocketPool { virtual LoadState GetLoadState(const std::string& group_name, const ClientSocketHandle* handle) const; - virtual Value* GetInfoAsValue(const std::string& name, - const std::string& type) const { + virtual DictionaryValue* GetInfoAsValue(const std::string& name, + const std::string& type, + bool include_nested_pools) const { return base_.GetInfoAsValue(name, type); } |