summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:19:03 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:19:03 +0000
commit6f08af88709675d9c1b63f9b7c7383844d36386f (patch)
treedfef137d617ecb26ff156aee7d800067e161d613 /content
parent2c7e28115d1334537dbf984ad6bf2bebf46c8739 (diff)
downloadchromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.zip
chromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.tar.gz
chromium_src-6f08af88709675d9c1b63f9b7c7383844d36386f.tar.bz2
Move the V8 benchmarking_extension.cc/.h files out of webkit/extensions into chrome as the functionality
exposed by this extension is chrome specific. The IPCs used by this extension have all been moved to chrome to a new header file benchmarking_messages.h in chrome\common. Added a new message filter object in chrome\browser which filters the benchmarking IPCs. Most of the changes in this CL are centered around ensuring that the benchmarking stuff gets initialized in the same order as before. Continuing changes to get rid of the pattern of IPC messags spanning across content and chrome. BUG=87335 Review URL: http://codereview.chromium.org/7885013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/app/content_main.cc3
-rw-r--r--content/browser/browser_main.cc2
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc1
-rw-r--r--content/browser/renderer_host/render_message_filter.cc162
-rw-r--r--content/browser/renderer_host/render_message_filter.h5
-rw-r--r--content/common/content_switches.cc3
-rw-r--r--content/common/content_switches.h1
-rw-r--r--content/common/view_messages.h35
-rw-r--r--content/renderer/render_thread.cc31
-rw-r--r--content/renderer/render_thread.h20
-rw-r--r--content/renderer/renderer_glue.cc24
11 files changed, 1 insertions, 286 deletions
diff --git a/content/app/content_main.cc b/content/app/content_main.cc
index b124193..12cc816 100644
--- a/content/app/content_main.cc
+++ b/content/app/content_main.cc
@@ -157,8 +157,7 @@ void InitializeStatsTable(base::ProcessId browser_pid,
// Chrome. These lines can be commented out to effectively turn
// counters 'off'. The table is created and exists for the life
// of the process. It is not cleaned up.
- if (command_line.HasSwitch(switches::kEnableStatsTable) ||
- command_line.HasSwitch(switches::kEnableBenchmarking)) {
+ if (command_line.HasSwitch(switches::kEnableStatsTable)) {
// NOTIMPLEMENTED: we probably need to shut this down correctly to avoid
// leaking shared memory regions on posix platforms.
std::string statsfile =
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc
index 2e165ec..5b0aa63 100644
--- a/content/browser/browser_main.cc
+++ b/content/browser/browser_main.cc
@@ -192,8 +192,6 @@ void BrowserMainParts::EarlyInitialization() {
SetupSandbox(parsed_command_line());
#endif
- if (parsed_command_line().HasSwitch(switches::kEnableBenchmarking))
- base::FieldTrial::EnableBenchmarking();
if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart))
net::SSLConfigService::DisableFalseStart();
if (parsed_command_line().HasSwitch(switches::kEnableSSLCachedInfo))
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index 2ff2c51..8578251 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -556,7 +556,6 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
switches::kDisableWebSockets,
switches::kEnableAccessibilityLogging,
switches::kEnableAdaptive,
- switches::kEnableBenchmarking,
switches::kEnableDCHECK,
switches::kEnableGPUServiceLogging,
switches::kEnableGPUClientLogging,
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 5037a66..3540f2a 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -43,10 +43,7 @@
#include "net/base/io_buffer.h"
#include "net/base/keygen_handler.h"
#include "net/base/mime_util.h"
-#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/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresenter.h"
@@ -104,20 +101,6 @@ class RenderMessageCompletionCallback {
IPC::Message* reply_msg_;
};
-class ClearCacheCompletion : public RenderMessageCompletionCallback,
- public net::CompletionCallback {
- public:
- ClearCacheCompletion(RenderMessageFilter* filter,
- IPC::Message* reply_msg)
- : RenderMessageCompletionCallback(filter, reply_msg) {
- }
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- ViewHostMsg_ClearCache::WriteReplyParams(reply_msg(), params.a);
- SendReplyAndDeleteThis();
- }
-};
-
class OpenChannelToPpapiPluginCallback : public RenderMessageCompletionCallback,
public PpapiPluginProcessHost::Client {
public:
@@ -182,55 +165,6 @@ class OpenChannelToPpapiBrokerCallback : public PpapiBrokerProcessHost::Client {
int request_id_;
};
-// Class to assist with clearing out the cache when we want to preserve
-// the sslhostinfo entries. It's not very efficient, but its just for debug.
-class DoomEntriesHelper {
- public:
- explicit DoomEntriesHelper(disk_cache::Backend* backend)
- : backend_(backend),
- entry_(NULL),
- iter_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(callback_(this,
- &DoomEntriesHelper::CacheCallback)),
- user_callback_(NULL) {
- }
-
- void ClearCache(ClearCacheCompletion* callback) {
- user_callback_ = callback;
- return CacheCallback(net::OK); // Start clearing the cache.
- }
-
- private:
- void CacheCallback(int result) {
- do {
- if (result != net::OK) {
- user_callback_->RunWithParams(Tuple1<int>(result));
- delete this;
- return;
- }
-
- if (entry_) {
- // Doom all entries except those with snapstart information.
- std::string key = entry_->GetKey();
- if (key.find("sslhostinfo:") != 0) {
- entry_->Doom();
- backend_->EndEnumeration(&iter_);
- iter_ = NULL; // We invalidated our iterator - start from the top!
- }
- entry_->Close();
- entry_ = NULL;
- }
- result = backend_->OpenNextEntry(&iter_, &entry_, &callback_);
- } while (result != net::ERR_IO_PENDING);
- }
-
- disk_cache::Backend* backend_;
- disk_cache::Entry* entry_;
- void* iter_;
- net::CompletionCallbackImpl<DoomEntriesHelper> callback_;
- ClearCacheCompletion* user_callback_;
-};
-
} // namespace
class RenderMessageFilter::OpenChannelToNpapiPluginCallback
@@ -414,15 +348,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB)
IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, OnFreeTransportDIB)
#endif
- IPC_MESSAGE_HANDLER(ViewHostMsg_CloseCurrentConnections,
- OnCloseCurrentConnections)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, OnSetCacheMode)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ClearCache, OnClearCache)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ClearHostResolverCache,
- OnClearHostResolverCache)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata,
OnCacheableMetadataAvailable)
- IPC_MESSAGE_HANDLER(ViewHostMsg_EnableSpdy, OnEnableSpdy)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen)
IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate,
@@ -710,85 +637,6 @@ void RenderMessageFilter::OnFreeTransportDIB(
}
#endif
-bool RenderMessageFilter::CheckBenchmarkingEnabled() const {
- static bool checked = false;
- static bool result = false;
- if (!checked) {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- result = command_line.HasSwitch(switches::kEnableBenchmarking);
- checked = true;
- }
- return result;
-}
-
-void RenderMessageFilter::OnCloseCurrentConnections() {
- // This function is disabled unless the user has enabled
- // benchmarking extensions.
- if (!CheckBenchmarkingEnabled())
- return;
- request_context_->GetURLRequestContext()->
- http_transaction_factory()->GetCache()->CloseAllConnections();
-}
-
-void RenderMessageFilter::OnSetCacheMode(bool enabled) {
- // This function is disabled unless the user has enabled
- // benchmarking extensions.
- if (!CheckBenchmarkingEnabled())
- return;
-
- net::HttpCache::Mode mode = enabled ?
- net::HttpCache::NORMAL : net::HttpCache::DISABLE;
- net::HttpCache* http_cache = request_context_->GetURLRequestContext()->
- http_transaction_factory()->GetCache();
- http_cache->set_mode(mode);
-}
-
-void RenderMessageFilter::OnClearCache(bool preserve_ssl_host_info,
- IPC::Message* reply_msg) {
- // This function is disabled unless the user has enabled
- // benchmarking extensions.
- int rv = -1;
- if (CheckBenchmarkingEnabled()) {
- disk_cache::Backend* backend = request_context_->GetURLRequestContext()->
- http_transaction_factory()->GetCache()->GetCurrentBackend();
- if (backend) {
- ClearCacheCompletion* callback =
- new ClearCacheCompletion(this, reply_msg);
- if (preserve_ssl_host_info) {
- DoomEntriesHelper* helper = new DoomEntriesHelper(backend);
- helper->ClearCache(callback); // Will self clean.
- return;
- } else {
- rv = backend->DoomAllEntries(callback);
- if (rv == net::ERR_IO_PENDING) {
- // The callback will send the reply.
- return;
- }
- // Completed synchronously, no need for the callback.
- delete callback;
- }
- }
- }
- ViewHostMsg_ClearCache::WriteReplyParams(reply_msg, rv);
- Send(reply_msg);
-}
-
-void RenderMessageFilter::OnClearHostResolverCache(int* result) {
- // This function is disabled unless the user has enabled
- // benchmarking extensions.
- *result = -1;
- DCHECK(CheckBenchmarkingEnabled());
- net::HostResolverImpl* host_resolver_impl =
- request_context_->GetURLRequestContext()->
- host_resolver()->GetAsHostResolverImpl();
- if (host_resolver_impl) {
- net::HostCache* cache = host_resolver_impl->cache();
- DCHECK(cache);
- cache->clear();
- *result = 0;
- }
-}
-
bool RenderMessageFilter::CheckPreparsedJsCachingEnabled() const {
static bool checked = false;
static bool result = false;
@@ -817,16 +665,6 @@ void RenderMessageFilter::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 RenderMessageFilter::OnEnableSpdy(bool enable) {
- if (enable) {
- net::HttpNetworkLayer::EnableSpdy("npn,force-alt-protocols");
- } else {
- net::HttpNetworkLayer::EnableSpdy("npn-http");
- }
-}
-
void RenderMessageFilter::OnKeygen(uint32 key_size_index,
const std::string& challenge_string,
const GURL& url,
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index 5d63975..70a0d8f 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -191,14 +191,9 @@ class RenderMessageFilter : public BrowserMessageFilter {
bool cache_in_browser,
TransportDIB::Handle* result);
void OnFreeTransportDIB(TransportDIB::Id dib_id);
- void OnCloseCurrentConnections();
- void OnSetCacheMode(bool enabled);
- void OnClearCache(bool preserve_ssl_host_info, IPC::Message* reply_msg);
- void OnClearHostResolverCache(int* result);
void OnCacheableMetadataAvailable(const GURL& url,
double expected_response_time,
const std::vector<char>& data);
- void OnEnableSpdy(bool enable);
void OnKeygen(uint32 key_size_index, const std::string& challenge_string,
const GURL& url, IPC::Message* reply_msg);
void OnKeygenOnWorkerThread(
diff --git a/content/common/content_switches.cc b/content/common/content_switches.cc
index 0587a60..afe8ca1 100644
--- a/content/common/content_switches.cc
+++ b/content/common/content_switches.cc
@@ -174,9 +174,6 @@ const char kEnableAccessibility[] = "enable-accessibility";
// Turns on extremely verbose logging of accessibility events.
const char kEnableAccessibilityLogging[] = "enable-accessibility-logging";
-// Enables the benchmarking extensions.
-const char kEnableBenchmarking[] = "enable-benchmarking";
-
// Enable DNS side checking of certificates. Still experimental, should only
// be used by developers at the current time.
const char kEnableDNSCertProvenanceChecking[] =
diff --git a/content/common/content_switches.h b/content/common/content_switches.h
index eef89e0..b9f1bb3 100644
--- a/content/common/content_switches.h
+++ b/content/common/content_switches.h
@@ -65,7 +65,6 @@ extern const char kEnableAccelerated2dCanvas[];
CONTENT_EXPORT extern const char kEnableAcceleratedDrawing[];
extern const char kEnableAccessibility[];
extern const char kEnableAccessibilityLogging[];
-CONTENT_EXPORT extern const char kEnableBenchmarking[];
CONTENT_EXPORT extern const char kEnableDNSCertProvenanceChecking[];
CONTENT_EXPORT extern const char kEnableDeviceMotion[];
CONTENT_EXPORT extern const char kDisableFullScreen[];
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 25ca41b..1165ffc 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -2026,41 +2026,6 @@ IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_Keygen,
std::string /* signed public key and challenge */)
// Message sent from the renderer to the browser to request that the browser
-// 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
-// enable or disable the cache. Used for debugging/testing.
-IPC_MESSAGE_CONTROL1(ViewHostMsg_SetCacheMode,
- bool /* enabled */)
-
-// Message sent from the renderer to the browser to request that the browser
-// clear the cache. Used for debugging/testing.
-// |preserve_ssl_host_info| controls whether clearing the cache will preserve
-// persisted SSL information stored in the cache.
-// |result| is the returned status from the operation.
-IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClearCache,
- bool /* preserve_ssl_host_info */,
- int /* result */)
-
-// Message sent from the renderer to the browser to request that the browser
-// clear the host cache. Used for debugging/testing.
-// |result| is the returned status from the operation.
-IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClearHostResolverCache,
- int /* result */)
-
-// Message sent from the renderer to the browser to request that the browser
-// clear the predictor cache. Used for debugging/testing.
-// |result| is the returned status from the operation.
-IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClearPredictorCache,
- 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/content/renderer/render_thread.cc b/content/renderer/render_thread.cc
index 4556c2f..376232a 100644
--- a/content/renderer/render_thread.cc
+++ b/content/renderer/render_thread.cc
@@ -66,7 +66,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "v8/include/v8.h"
-#include "webkit/extensions/v8/benchmarking_extension.h"
#include "webkit/extensions/v8/playback_extension.h"
#include "webkit/glue/webkit_glue.h"
@@ -432,9 +431,6 @@ void RenderThread::EnsureWebKitInitialized() {
webkit_glue::EnableWebCoreLogChannels(
command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));
- if (command_line.HasSwitch(switches::kEnableBenchmarking))
- RegisterExtension(extensions_v8::BenchmarkingExtension::Get());
-
if (command_line.HasSwitch(switches::kPlaybackMode) ||
command_line.HasSwitch(switches::kRecordMode) ||
command_line.HasSwitch(switches::kNoJsRandomness)) {
@@ -587,33 +583,6 @@ void RenderThread::OnCreateNewView(const ViewMsg_New_Params& params) {
params.frame_name);
}
-void RenderThread::CloseCurrentConnections() {
- Send(new ViewHostMsg_CloseCurrentConnections());
-}
-
-void RenderThread::SetCacheMode(bool enabled) {
- Send(new ViewHostMsg_SetCacheMode(enabled));
-}
-
-void RenderThread::ClearCache(bool preserve_ssl_host_info) {
- int rv;
- Send(new ViewHostMsg_ClearCache(preserve_ssl_host_info, &rv));
-}
-
-void RenderThread::ClearHostResolverCache() {
- int rv;
- Send(new ViewHostMsg_ClearHostResolverCache(&rv));
-}
-
-void RenderThread::ClearPredictorCache() {
- int rv;
- Send(new ViewHostMsg_ClearPredictorCache(&rv));
-}
-
-void RenderThread::EnableSpdy(bool enable) {
- Send(new ViewHostMsg_EnableSpdy(enable));
-}
-
GpuChannelHost* RenderThread::EstablishGpuChannelSync(
content::CauseForGpuLaunch cause_for_gpu_launch) {
if (gpu_channel_.get()) {
diff --git a/content/renderer/render_thread.h b/content/renderer/render_thread.h
index da651ef..351cbcb 100644
--- a/content/renderer/render_thread.h
+++ b/content/renderer/render_thread.h
@@ -190,26 +190,6 @@ class CONTENT_EXPORT RenderThread : public RenderThreadBase,
idle_notification_delay_in_s_ = idle_notification_delay_in_s;
}
- // 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);
-
- // Sends a message to the browser to clear the disk cache.
- // |preserve_ssl_host_info| is a flag indicating if the cache should purge
- // entries related to cached SSL information.
- void ClearCache(bool preserve_ssl_host_info);
-
- // Sends a message to the browser to clear thed host cache.
- void ClearHostResolverCache();
-
- // Sends a message to the browser to clear the predictor cache.
- void ClearPredictorCache();
-
- // Sends a message to the browser to enable/disable spdy.
- void EnableSpdy(bool enable);
-
// Synchronously establish a channel to the GPU plugin if not previously
// established or if it has been lost (for example if the GPU plugin crashed).
// If there is a pending asynchronous request, it will be completed by the
diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc
index 93db367..8f20b36 100644
--- a/content/renderer/renderer_glue.cc
+++ b/content/renderer/renderer_glue.cc
@@ -225,34 +225,10 @@ WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create(
return dispatcher->CreateBridge(handle, delegate);
}
-void CloseCurrentConnections() {
- RenderThread::current()->CloseCurrentConnections();
-}
-
-void SetCacheMode(bool enabled) {
- RenderThread::current()->SetCacheMode(enabled);
-}
-
-void ClearCache(bool preserve_ssl_host_info) {
- RenderThread::current()->ClearCache(preserve_ssl_host_info);
-}
-
-void ClearHostResolverCache() {
- RenderThread::current()->ClearHostResolverCache();
-}
-
-void ClearPredictorCache() {
- RenderThread::current()->ClearPredictorCache();
-}
-
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) {