diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 01:19:03 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 01:19:03 +0000 |
commit | 6f08af88709675d9c1b63f9b7c7383844d36386f (patch) | |
tree | dfef137d617ecb26ff156aee7d800067e161d613 /content/browser | |
parent | 2c7e28115d1334537dbf984ad6bf2bebf46c8739 (diff) | |
download | chromium_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/browser')
4 files changed, 0 insertions, 170 deletions
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( |