diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 01:02:53 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 01:02:53 +0000 |
commit | c40acc381fce1ac7f58975d45bd88e26a5e4a973 (patch) | |
tree | c7ad6b6abbf1ce022f2f74e6ae70d941072cacde /net | |
parent | 9263a4957be27c1c3e0aec8170b6f161619300ca (diff) | |
download | chromium_src-c40acc381fce1ac7f58975d45bd88e26a5e4a973.zip chromium_src-c40acc381fce1ac7f58975d45bd88e26a5e4a973.tar.gz chromium_src-c40acc381fce1ac7f58975d45bd88e26a5e4a973.tar.bz2 |
Rename CloseIdleConnections -> CloseCurrentConnections.
This method is (and was) just for debugging; while it was closing
idle connections, that was not aggressive enough; the benchmark needs
to close all connections, not just the idle ones.
To ensure connections are abandoned, create a new pool; leaving the old pool
to languish as any pending sockets die.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/549031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_cache.cc | 3 | ||||
-rw-r--r-- | net/http/http_cache.h | 6 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 8 | ||||
-rw-r--r-- | net/http/http_network_session.h | 4 |
4 files changed, 18 insertions, 3 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index ed532b4..8a76ad1 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -524,7 +524,7 @@ void HttpCache::OnProcessPendingQueue(ActiveEntry* entry) { AddTransactionToEntry(entry, next); } -void HttpCache::CloseIdleConnections() { +void HttpCache::CloseCurrentConnections() { net::HttpNetworkLayer* network = static_cast<net::HttpNetworkLayer*>(network_layer_.get()); HttpNetworkSession* session = network->GetSession(); @@ -532,6 +532,7 @@ void HttpCache::CloseIdleConnections() { session->tcp_socket_pool()->CloseIdleSockets(); if (session->flip_session_pool()) session->flip_session_pool()->CloseAllSessions(); + session->ReplaceTCPSocketPool(); } } diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 959b76c..6cd8718 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -132,8 +132,10 @@ class HttpCache : public HttpTransactionFactory, void set_type(CacheType type) { type_ = type; } CacheType type() { return type_; } - // Close All Idle Sockets. This is for debugging. - void CloseIdleConnections(); + // Close currently active sockets so that fresh page loads will not use any + // recycled connections. For sockets currently in use, they may not close + // immediately, but they will not be reusable. This is for debugging. + void CloseCurrentConnections(); void set_enable_range_support(bool value) { enable_range_support_ = value; diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 560c3b5..150c6f0 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -51,4 +51,12 @@ void HttpNetworkSession::set_max_sockets_per_group(int socket_count) { max_sockets_per_group_ = socket_count; } +void HttpNetworkSession::ReplaceTCPSocketPool() { + tcp_socket_pool_ = new TCPClientSocketPool(max_sockets_, + max_sockets_per_group_, + host_resolver_, + socket_factory_, + network_change_notifier_); +} + } // namespace net diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 6eb92db..684da16 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -44,6 +44,10 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { return flip_session_pool_; } + // Replace the current socket pool with a new one. This effectively + // abandons the current pool. This is only used for debugging. + void ReplaceTCPSocketPool(); + static void set_max_sockets_per_group(int socket_count); static uint16 fixed_http_port() { return g_fixed_http_port; } |