summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 01:02:53 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-14 01:02:53 +0000
commitc40acc381fce1ac7f58975d45bd88e26a5e4a973 (patch)
treec7ad6b6abbf1ce022f2f74e6ae70d941072cacde
parent9263a4957be27c1c3e0aec8170b6f161619300ca (diff)
downloadchromium_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
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc8
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h2
-rw-r--r--chrome/common/render_messages_internal.h4
-rw-r--r--chrome/renderer/render_thread.cc4
-rw-r--r--chrome/renderer/render_thread.h4
-rw-r--r--chrome/renderer/renderer_glue.cc4
-rw-r--r--net/http/http_cache.cc3
-rw-r--r--net/http/http_cache.h6
-rw-r--r--net/http/http_network_session.cc8
-rw-r--r--net/http/http_network_session.h4
-rw-r--r--webkit/extensions/v8/benchmarking_extension.cc2
-rw-r--r--webkit/glue/webkit_glue.h4
-rw-r--r--webkit/tools/test_shell/test_shell.cc2
13 files changed, 35 insertions, 20 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 3821384..66625f5 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -398,8 +398,8 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension,
OnOpenChannelToExtension)
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToTab, OnOpenChannelToTab)
- IPC_MESSAGE_HANDLER(ViewHostMsg_CloseIdleConnections,
- OnCloseIdleConnections)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections,
+ OnCloseCurrentConnections)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, OnGetFileSize)
IPC_MESSAGE_HANDLER(ViewHostMsg_Keygen, OnKeygen)
@@ -1124,13 +1124,13 @@ bool ResourceMessageFilter::CheckBenchmarkingEnabled() {
return result;
}
-void ResourceMessageFilter::OnCloseIdleConnections() {
+void ResourceMessageFilter::OnCloseCurrentConnections() {
// This function is disabled unless the user has enabled
// benchmarking extensions.
if (!CheckBenchmarkingEnabled())
return;
request_context_->GetURLRequestContext()->
- http_transaction_factory()->GetCache()->CloseIdleConnections();
+ http_transaction_factory()->GetCache()->CloseCurrentConnections();
}
void ResourceMessageFilter::OnSetCacheMode(bool enabled) {
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 0da26f0f..15b06f7 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -290,7 +290,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
const std::string& extension_id,
const std::string& channel_name, int* port_id);
- void OnCloseIdleConnections();
+ void OnCloseCurrentConnections();
void OnSetCacheMode(bool enabled);
void OnGetFileSize(const FilePath& path, IPC::Message* reply_msg);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index dde0fe7..d9af024 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1831,8 +1831,8 @@ IPC_BEGIN_MESSAGES(ViewHost)
int /* accessibility object id */)
// Message sent from the renderer to the browser to request that the browser
- // close all idle sockets. Used for debugging/testing.
- IPC_MESSAGE_CONTROL0(ViewHostMsg_CloseIdleConnections)
+ // close all sockets. Used for debugging/testing.
+ IPC_MESSAGE_CONTROL0(ViewHostMsg_CloseCurrentConnections)
// Message sent from the renderer to the browser to request that the browser
// close all idle sockets. Used for debugging/testing.
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 632adab..0a5fe6a 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -482,8 +482,8 @@ void RenderThread::InformHostOfCacheStatsLater() {
kCacheStatsDelayMS);
}
-void RenderThread::CloseIdleConnections() {
- Send(new ViewHostMsg_CloseIdleConnections());
+void RenderThread::CloseCurrentConnections() {
+ Send(new ViewHostMsg_CloseCurrentConnections());
}
void RenderThread::SetCacheMode(bool enabled) {
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index 6769b06..bde662a 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -140,8 +140,8 @@ class RenderThread : public RenderThreadBase,
// bookkeeping operation off the critical latency path.
void InformHostOfCacheStatsLater();
- // Sends a message to the browser to close all idle connections.
- void CloseIdleConnections();
+ // Sends a message to the browser to close all connections.
+ void CloseCurrentConnections();
// Sends a message to the browser to enable or disable the disk cache.
void SetCacheMode(bool enabled);
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index c3d1fe7..ec9e3b2 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -238,8 +238,8 @@ void NotifyCacheStats() {
RenderThread::current()->InformHostOfCacheStatsLater();
}
-void CloseIdleConnections() {
- RenderThread::current()->CloseIdleConnections();
+void CloseCurrentConnections() {
+ RenderThread::current()->CloseCurrentConnections();
}
void SetCacheMode(bool enabled) {
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; }
diff --git a/webkit/extensions/v8/benchmarking_extension.cc b/webkit/extensions/v8/benchmarking_extension.cc
index 4823718..0583f70 100644
--- a/webkit/extensions/v8/benchmarking_extension.cc
+++ b/webkit/extensions/v8/benchmarking_extension.cc
@@ -49,7 +49,7 @@ class BenchmarkingWrapper : public v8::Extension {
}
static v8::Handle<v8::Value> CloseConnections(const v8::Arguments& args) {
- webkit_glue::CloseIdleConnections();
+ webkit_glue::CloseCurrentConnections();
return v8::Undefined();
}
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index c46e094a..026b47f 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -225,8 +225,8 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list);
// the form language-country (e.g., en-US or pt-BR).
std::wstring GetWebKitLocale();
-// Close idle connections. Used for debugging.
-void CloseIdleConnections();
+// Close current connections. Used for debugging.
+void CloseCurrentConnections();
// Enable or disable the disk cache. Used for debugging.
void SetCacheMode(bool enabled);
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 1745f37..c93d814 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -753,7 +753,7 @@ std::wstring GetWebKitLocale() {
return L"en-US";
}
-void CloseIdleConnections() {
+void CloseCurrentConnections() {
// Used in benchmarking, Ignored for test_shell.
}