diff options
author | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-13 21:54:36 +0000 |
---|---|---|
committer | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-13 21:54:36 +0000 |
commit | 5e3295b097dfbb98649faa41e1d08bc19988c322 (patch) | |
tree | 99b0f13d0d6ef222585eb7083484dd4fc5c5375e | |
parent | 3579f8fba28dc636dce1bb648574718d82bac3b8 (diff) | |
download | chromium_src-5e3295b097dfbb98649faa41e1d08bc19988c322.zip chromium_src-5e3295b097dfbb98649faa41e1d08bc19988c322.tar.gz chromium_src-5e3295b097dfbb98649faa41e1d08bc19988c322.tar.bz2 |
Remove extension-specific page load time histogram support for webrequest
This CL removes the code responsible for providing PLT histogram data for specific extensions using the WebRequest API.
Code providing such data not bound to specific extensions is kept.
BUG=100411
Review URL: https://codereview.chromium.org/335573003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277096 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/web_request/web_request_api.cc | 19 | ||||
-rw-r--r-- | chrome/browser/extensions/api/web_request/web_request_api.h | 1 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 25 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.h | 8 | ||||
-rw-r--r-- | chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc | 12 | ||||
-rw-r--r-- | chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h | 22 | ||||
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 148 | ||||
-rw-r--r-- | extensions/browser/runtime_data.h | 1 | ||||
-rw-r--r-- | extensions/browser/runtime_data_unittest.cc | 1 | ||||
-rw-r--r-- | extensions/common/extension_messages.h | 6 | ||||
-rw-r--r-- | extensions/renderer/dispatcher.cc | 6 | ||||
-rw-r--r-- | extensions/renderer/dispatcher.h | 4 | ||||
-rw-r--r-- | extensions/renderer/dispatcher_delegate.h | 4 |
13 files changed, 30 insertions, 227 deletions
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 2545598..025fc2d 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -2470,25 +2470,16 @@ void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { if (!profile) return; - bool adblock = false; - bool adblock_plus = false; - bool other = false; + bool webrequest_used = false; const extensions::ExtensionSet& extensions = extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); extensions::RuntimeData* runtime_data = extensions::ExtensionSystem::Get(profile)->runtime_data(); for (extensions::ExtensionSet::const_iterator it = extensions.begin(); - it != extensions.end(); ++it) { - if (runtime_data->HasUsedWebRequest(it->get())) { - if ((*it)->name().find("Adblock Plus") != std::string::npos) { - adblock_plus = true; - } else if ((*it)->name().find("AdBlock") != std::string::npos) { - adblock = true; - } else { - other = true; - } - } + !webrequest_used && it != extensions.end(); + ++it) { + webrequest_used |= runtime_data->HasUsedWebRequest(it->get()); } - host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); + host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used)); } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.h b/chrome/browser/extensions/api/web_request/web_request_api.h index 816d33a0..de0a6fc 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.h +++ b/chrome/browser/extensions/api/web_request/web_request_api.h @@ -524,7 +524,6 @@ class WebRequestHandlerBehaviorChangedFunction // Send updates to |host| with information about what webRequest-related // extensions are installed. -// TODO(mpcomplete): remove. http://crbug.com/100411 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 983262a..a30e0d0 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -1332,29 +1332,10 @@ void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) { } #endif -bool ChromeContentRendererClient::IsAdblockInstalled() { - return g_current_client->extension_dispatcher_->extensions()->Contains( - "gighmmpiobklfepjocnamgkkbiglidom"); -} - -bool ChromeContentRendererClient::IsAdblockPlusInstalled() { - return g_current_client->extension_dispatcher_->extensions()->Contains( - "cfhdojbkjhnklbpkdaibdccddilifddb"); -} - -bool ChromeContentRendererClient::IsAdblockWithWebRequestInstalled() { - return g_current_client->extension_dispatcher_delegate_ - ->IsAdblockWithWebRequestInstalled(); -} - -bool ChromeContentRendererClient::IsAdblockPlusWithWebRequestInstalled() { - return g_current_client->extension_dispatcher_delegate_ - ->IsAdblockPlusWithWebRequestInstalled(); -} - -bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { +// static +bool ChromeContentRendererClient::WasWebRequestUsedBySomeExtensions() { return g_current_client->extension_dispatcher_delegate_ - ->IsOtherExtensionWithWebRequestInstalled(); + ->WasWebRequestUsedBySomeExtensions(); } const void* ChromeContentRendererClient::CreatePPAPIInterface( diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index 7fe7a82..28da0eb 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -152,13 +152,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient { static bool IsExtensionOrSharedModuleWhitelisted( const GURL& url, const std::set<std::string>& whitelist); - // TODO(mpcomplete): remove after we collect histogram data. - // http://crbug.com/100411 - static bool IsAdblockInstalled(); - static bool IsAdblockPlusInstalled(); - static bool IsAdblockWithWebRequestInstalled(); - static bool IsAdblockPlusWithWebRequestInstalled(); - static bool IsOtherExtensionWithWebRequestInstalled(); + static bool WasWebRequestUsedBySomeExtensions(); private: FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc index e87411d..8ea9568 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc @@ -50,9 +50,7 @@ using extensions::NativeHandler; ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() - : webrequest_adblock_(false), - webrequest_adblock_plus_(false), - webrequest_other_(false) { + : webrequest_used_(false) { } ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() { @@ -354,10 +352,6 @@ void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( } void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( - bool adblock, - bool adblock_plus, - bool other) { - webrequest_adblock_ = adblock; - webrequest_adblock_plus_ = adblock_plus; - webrequest_other_ = other; + bool webrequest_used) { + webrequest_used_ = webrequest_used; } diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h index 5bb8006..c976467 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h @@ -13,16 +13,7 @@ class ChromeExtensionsDispatcherDelegate ChromeExtensionsDispatcherDelegate(); virtual ~ChromeExtensionsDispatcherDelegate(); - // TODO(mpcomplete): remove. http://crbug.com/100411 - bool IsAdblockWithWebRequestInstalled() const { return webrequest_adblock_; } - - bool IsAdblockPlusWithWebRequestInstalled() const { - return webrequest_adblock_plus_; - } - - bool IsOtherExtensionWithWebRequestInstalled() const { - return webrequest_other_; - } + bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } private: // extensions::DispatcherDelegate implementation. @@ -57,15 +48,10 @@ class ChromeExtensionsDispatcherDelegate int tab_id, const std::string& extension_id, const extensions::URLPatternSet& origin_set) OVERRIDE; - virtual void HandleWebRequestAPIUsage(bool adblock, - bool adblock_plus, - bool other_webrequest) OVERRIDE; + virtual void HandleWebRequestAPIUsage(bool webrequest_used) OVERRIDE; - // Status of webrequest usage for known extensions. - // TODO(mpcomplete): remove. http://crbug.com/100411 - bool webrequest_adblock_; - bool webrequest_adblock_plus_; - bool webrequest_other_; + // Status of webrequest usage. + bool webrequest_used_; DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDispatcherDelegate); }; diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 5de8108..bce3fc4 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -724,163 +724,31 @@ void PageLoadHistograms::Dump(WebFrame* frame) { begin_to_finish_all_loads); } - // TODO(mpcomplete): remove the extension-related histograms after we collect - // enough data. http://crbug.com/100411 - const bool use_adblock_histogram = - ChromeContentRendererClient::IsAdblockInstalled(); - if (use_adblock_histogram) { + const bool use_webrequest_histogram = + ChromeContentRendererClient::WasWebRequestUsedBySomeExtensions(); + if (use_webrequest_histogram) { UMA_HISTOGRAM_ENUMERATION( - "PLT.Abandoned_ExtensionAdblock", + "PLT.Abandoned_ExtensionWebRequest", abandoned_page ? 1 : 0, 2); switch (load_type) { case DocumentState::NORMAL_LOAD: PLT_HISTOGRAM( - "PLT.BeginToFinish_NormalLoad_ExtensionAdblock", + "PLT.BeginToFinish_NormalLoad_ExtensionWebRequest", begin_to_finish_all_loads); break; case DocumentState::LINK_LOAD_NORMAL: PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblock", + "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequest", begin_to_finish_all_loads); break; case DocumentState::LINK_LOAD_RELOAD: PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblock", + "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequest", begin_to_finish_all_loads); break; case DocumentState::LINK_LOAD_CACHE_STALE_OK: PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblock", - begin_to_finish_all_loads); - break; - default: - break; - } - } - - const bool use_adblockplus_histogram = - ChromeContentRendererClient::IsAdblockPlusInstalled(); - if (use_adblockplus_histogram) { - UMA_HISTOGRAM_ENUMERATION( - "PLT.Abandoned_ExtensionAdblockPlus", - abandoned_page ? 1 : 0, 2); - switch (load_type) { - case DocumentState::NORMAL_LOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_NormalLoad_ExtensionAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadNormal_ExtensionAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadReload_ExtensionAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionAdblockPlus", - begin_to_finish_all_loads); - break; - default: - break; - } - } - - const bool use_webrequest_adblock_histogram = - ChromeContentRendererClient::IsAdblockWithWebRequestInstalled(); - if (use_webrequest_adblock_histogram) { - UMA_HISTOGRAM_ENUMERATION( - "PLT.Abandoned_ExtensionWebRequestAdblock", - abandoned_page ? 1 : 0, 2); - switch (load_type) { - case DocumentState::NORMAL_LOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblock", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblock", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblock", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblock", - begin_to_finish_all_loads); - break; - default: - break; - } - } - - const bool use_webrequest_adblockplus_histogram = - ChromeContentRendererClient:: - IsAdblockPlusWithWebRequestInstalled(); - if (use_webrequest_adblockplus_histogram) { - UMA_HISTOGRAM_ENUMERATION( - "PLT.Abandoned_ExtensionWebRequestAdblockPlus", - abandoned_page ? 1 : 0, 2); - switch (load_type) { - case DocumentState::NORMAL_LOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestAdblockPlus", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestAdblockPlus", - begin_to_finish_all_loads); - break; - default: - break; - } - } - - const bool use_webrequest_other_histogram = - ChromeContentRendererClient:: - IsOtherExtensionWithWebRequestInstalled(); - if (use_webrequest_other_histogram) { - UMA_HISTOGRAM_ENUMERATION( - "PLT.Abandoned_ExtensionWebRequestOther", - abandoned_page ? 1 : 0, 2); - switch (load_type) { - case DocumentState::NORMAL_LOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_NormalLoad_ExtensionWebRequestOther", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadNormal_ExtensionWebRequestOther", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadReload_ExtensionWebRequestOther", - begin_to_finish_all_loads); - break; - case DocumentState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM( - "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequestOther", + "PLT.BeginToFinish_LinkLoadStaleOk_ExtensionWebRequest", begin_to_finish_all_loads); break; default: diff --git a/extensions/browser/runtime_data.h b/extensions/browser/runtime_data.h index 0dd2cb3..f02cac2 100644 --- a/extensions/browser/runtime_data.h +++ b/extensions/browser/runtime_data.h @@ -40,7 +40,6 @@ class RuntimeData : public ExtensionRegistryObserver { // Getter and setter for the flag that specifies if the extension has used // the webrequest API. - // TODO(mpcomplete): remove. http://crbug.com/100411 bool HasUsedWebRequest(const Extension* extension) const; void SetHasUsedWebRequest(const Extension* extension, bool value); diff --git a/extensions/browser/runtime_data_unittest.cc b/extensions/browser/runtime_data_unittest.cc index f0cbf4e..913aed3 100644 --- a/extensions/browser/runtime_data_unittest.cc +++ b/extensions/browser/runtime_data_unittest.cc @@ -80,7 +80,6 @@ TEST_F(RuntimeDataTest, IsBeingUpgraded) { EXPECT_FALSE(runtime_data_.IsBeingUpgraded(extension)); } -// TODO(mpcomplete): Remove. http://crbug.com/100411 TEST_F(RuntimeDataTest, HasUsedWebRequest) { scoped_refptr<Extension> extension = CreateExtension(); diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index 35a63ad..edf49a4 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h @@ -394,10 +394,8 @@ IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType, extensions::ViewType /* view_type */) // Deliver a message sent with ExtensionHostMsg_PostMessage. -IPC_MESSAGE_CONTROL3(ExtensionMsg_UsingWebRequestAPI, - bool /* adblock */, - bool /* adblock_plus */, - bool /* other_webrequest */) +IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI, + bool /* webrequest_used */) // Ask the lazy background page if it is ready to be suspended. This is sent // when the page is considered idle. The renderer will reply with the same diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 12beada..6151bb0 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -787,10 +787,8 @@ void Dispatcher::OnUpdateUserScripts( UpdateActiveExtensions(); } -void Dispatcher::OnUsingWebRequestAPI(bool adblock, - bool adblock_plus, - bool other_webrequest) { - delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); +void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) { + delegate_->HandleWebRequestAPIUsage(webrequest_used); } void Dispatcher::UpdateActiveExtensions() { diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h index aaf2724..8729cc2 100644 --- a/extensions/renderer/dispatcher.h +++ b/extensions/renderer/dispatcher.h @@ -182,9 +182,7 @@ class Dispatcher : public content::RenderProcessObserver { const URLPatternSet& origin_set); void OnUpdateUserScripts(base::SharedMemoryHandle scripts, const std::set<std::string>& extension_ids); - void OnUsingWebRequestAPI(bool adblock, - bool adblock_plus, - bool other_webrequest); + void OnUsingWebRequestAPI(bool webrequest_used); void UpdateActiveExtensions(); diff --git a/extensions/renderer/dispatcher_delegate.h b/extensions/renderer/dispatcher_delegate.h index c8120c0..6faeb97 100644 --- a/extensions/renderer/dispatcher_delegate.h +++ b/extensions/renderer/dispatcher_delegate.h @@ -86,9 +86,7 @@ class DispatcherDelegate { // Allows the delegate to respond to reports from the browser about WebRequest // API usage from within this process. - virtual void HandleWebRequestAPIUsage(bool adblock, - bool adblock_plus, - bool other_webrequest) {} + virtual void HandleWebRequestAPIUsage(bool webrequest_used) {} }; } // namespace extensions |