summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 17:30:54 +0000
committerlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 17:30:54 +0000
commit12893c317ae3887de59727df0de45faae3f660e6 (patch)
tree9a2c5515c4fec605af1a5b073bfdb5aa46ced546
parent36955358355136978385ac8bb829807648c462e2 (diff)
downloadchromium_src-12893c317ae3887de59727df0de45faae3f660e6.zip
chromium_src-12893c317ae3887de59727df0de45faae3f660e6.tar.gz
chromium_src-12893c317ae3887de59727df0de45faae3f660e6.tar.bz2
Enable/Disable Spdy in benchmarking.
Test=none Bug=52624 Review URL: http://codereview.chromium.org/3169022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56704 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc12
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h1
-rw-r--r--chrome/common/render_messages_internal.h5
-rw-r--r--chrome/renderer/render_thread.cc4
-rw-r--r--chrome/renderer/render_thread.h3
-rw-r--r--chrome/renderer/renderer_glue.cc4
-rw-r--r--webkit/extensions/v8/benchmarking_extension.cc15
-rw-r--r--webkit/glue/webkit_glue.h3
-rw-r--r--webkit/support/webkit_support_glue.cc3
-rw-r--r--webkit/tools/test_shell/test_shell.cc4
10 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 8a70211..e7985a0 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -84,6 +84,7 @@
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache.h"
+#include "net/http/http_network_layer.h"
#include "net/http/http_transaction_factory.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h"
@@ -485,6 +486,7 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata,
OnCacheableMetadataAvailable)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_EnableSpdy, OnEnableSpdy)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, OnGetFileSize)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileModificationTime,
OnGetFileModificationTime)
@@ -1368,6 +1370,16 @@ void ResourceMessageFilter::OnCacheableMetadataAvailable(
url, base::Time::FromDoubleT(expected_response_time), buf, data.size());
}
+// TODO(lzheng): This only enables spdy over ssl. Enable spdy for http
+// when needed.
+void ResourceMessageFilter::OnEnableSpdy(bool enable) {
+ if (enable) {
+ net::HttpNetworkLayer::EnableSpdy("npn");
+ } else {
+ net::HttpNetworkLayer::EnableSpdy("npn-http");
+ }
+}
+
void ResourceMessageFilter::OnGetFileSize(const FilePath& path,
IPC::Message* reply_msg) {
// Get file size only when the child process has been granted permission to
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index cc1a15f..ebd94a6 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -335,6 +335,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
void OnCacheableMetadataAvailable(const GURL& url,
double expected_response_time,
const std::vector<char>& data);
+ void OnEnableSpdy(bool enable);
void OnGetFileSize(const FilePath& path, IPC::Message* reply_msg);
void OnGetFileModificationTime(const FilePath& path, IPC::Message* reply_msg);
void OnGetFileInfoOnFileThread(const FilePath& path,
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 46210aa..c60dd96 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -2208,6 +2208,11 @@ IPC_BEGIN_MESSAGES(ViewHost)
int /* result */)
// Message sent from the renderer to the browser to request that the browser
+ // enable or disable spdy. Used for debugging/testing/benchmarking.
+ IPC_MESSAGE_CONTROL1(ViewHostMsg_EnableSpdy,
+ bool /* enable */)
+
+ // Message sent from the renderer to the browser to request that the browser
// cache |data| associated with |url|.
IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata,
GURL /* url */,
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 15e244c..d89615b 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -743,6 +743,10 @@ void RenderThread::ClearCache() {
Send(new ViewHostMsg_ClearCache(&rv));
}
+void RenderThread::EnableSpdy(bool enable) {
+ Send(new ViewHostMsg_EnableSpdy(enable));
+}
+
void RenderThread::UpdateActiveExtensions() {
// In single-process mode, the browser process reports the active extensions.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index 4990b553..f00abd6 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -199,6 +199,9 @@ class RenderThread : public RenderThreadBase,
// Sends a message to the browser to clear the disk cache.
void ClearCache();
+ // Sends a message to the browser to enable/disable spdy.
+ void EnableSpdy(bool enable);
+
// Update the list of active extensions that will be reported when we crash.
void UpdateActiveExtensions();
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 2e20197..9691d58 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -312,6 +312,10 @@ bool IsSingleProcess() {
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
}
+void EnableSpdy(bool enable) {
+ RenderThread::current()->EnableSpdy(enable);
+}
+
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
diff --git a/webkit/extensions/v8/benchmarking_extension.cc b/webkit/extensions/v8/benchmarking_extension.cc
index 5790ee4..31bb080 100644
--- a/webkit/extensions/v8/benchmarking_extension.cc
+++ b/webkit/extensions/v8/benchmarking_extension.cc
@@ -4,6 +4,7 @@
#include "base/command_line.h"
#include "base/stats_table.h"
+#include "net/http/http_network_layer.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
#include "webkit/extensions/v8/benchmarking_extension.h"
#include "webkit/glue/webkit_glue.h"
@@ -36,6 +37,10 @@ class BenchmarkingWrapper : public v8::Extension {
" native function GetCounter();"
" return GetCounter(name);"
"};"
+ "chrome.benchmarking.enableSpdy = function(name) {"
+ " native function EnableSpdy();"
+ " EnableSpdy(name);"
+ "};"
"chrome.benchmarking.isSingleProcess = function() {"
" native function IsSingleProcess();"
" return IsSingleProcess();"
@@ -48,6 +53,8 @@ class BenchmarkingWrapper : public v8::Extension {
return v8::FunctionTemplate::New(CloseConnections);
} else if (name->Equals(v8::String::New("ClearCache"))) {
return v8::FunctionTemplate::New(ClearCache);
+ } else if (name->Equals(v8::String::New("EnableSpdy"))) {
+ return v8::FunctionTemplate::New(EnableSpdy);
} else if (name->Equals(v8::String::New("GetCounter"))) {
return v8::FunctionTemplate::New(GetCounter);
} else if (name->Equals(v8::String::New("IsSingleProcess"))) {
@@ -67,6 +74,14 @@ class BenchmarkingWrapper : public v8::Extension {
return v8::Undefined();
}
+ static v8::Handle<v8::Value> EnableSpdy(const v8::Arguments& args) {
+ if (!args.Length() || !args[0]->IsBoolean())
+ return v8::Undefined();
+
+ webkit_glue::EnableSpdy(args[0]->BooleanValue());
+ return v8::Undefined();
+ }
+
static v8::Handle<v8::Value> GetCounter(const v8::Arguments& args) {
if (!args.Length() || !args[0]->IsString() || !StatsTable::current())
return v8::Undefined();
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index d912494..6c7387d 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -265,6 +265,9 @@ std::string GetProductVersion();
// Returns true if the embedder is running in single process mode.
bool IsSingleProcess();
+// Enables/Disables Spdy for requests afterwards. Used for benchmarking.
+void EnableSpdy(bool enable);
+
#if defined(OS_LINUX)
// Return a read-only file descriptor to the font which best matches the given
// properties or -1 on failure.
diff --git a/webkit/support/webkit_support_glue.cc b/webkit/support/webkit_support_glue.cc
index bae6374..96eb800 100644
--- a/webkit/support/webkit_support_glue.cc
+++ b/webkit/support/webkit_support_glue.cc
@@ -72,6 +72,9 @@ bool IsSingleProcess() {
return true;
}
+void EnableSpdy(bool enable) {
+}
+
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index c4023d5..07416a6 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -805,6 +805,10 @@ void ClearCache() {
// Used in benchmarking, Ignored for test_shell.
}
+void EnableSpdy(bool enable) {
+ // Used in benchmarking, Ignored for test_shell.
+}
+
std::string GetProductVersion() {
return std::string("Chrome/0.0.0.0");
}