Commit f00bafe1 authored by thestig's avatar thestig Committed by Commit bot

Measure the number of frame loads with Flash.

Also measure the number of frame loads for comparison, and the number of Flash instances created while we are at it.

BUG=403800

Review URL: https://codereview.chromium.org/687273004

Cr-Commit-Position: refs/heads/master@{#302522}
parent 63fff39d
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "content/public/browser/page_navigator.h" #include "content/public/browser/page_navigator.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/stream_handle.h" #include "content/public/browser/stream_handle.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/bindings_policy.h" #include "content/public/common/bindings_policy.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -873,6 +874,10 @@ void NavigatorImpl::RecordNavigationMetrics( ...@@ -873,6 +874,10 @@ void NavigatorImpl::RecordNavigationMetrics(
const FrameHostMsg_DidCommitProvisionalLoad_Params& params, const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
SiteInstance* site_instance) { SiteInstance* site_instance) {
DCHECK(site_instance->HasProcess()); DCHECK(site_instance->HasProcess());
if (!details.is_in_page)
RecordAction(base::UserMetricsAction("FrameLoad"));
if (!details.is_main_frame || !navigation_data_ || if (!details.is_main_frame || !navigation_data_ ||
navigation_data_->url_ != params.original_request_url) { navigation_data_->url_ != params.original_request_url) {
return; return;
......
...@@ -390,6 +390,10 @@ void InitLatencyInfo(ui::LatencyInfo* new_latency, ...@@ -390,6 +390,10 @@ void InitLatencyInfo(ui::LatencyInfo* new_latency,
} }
} }
bool IsFlashPlugin(PluginModule* module) {
return module->name() == kFlashPluginName;
}
} // namespace } // namespace
// static // static
...@@ -586,7 +590,7 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl( ...@@ -586,7 +590,7 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
power_saver_enabled_ = power_saver_enabled_ =
CommandLine::ForCurrentProcess()->HasSwitch( CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePluginPowerSaver) && switches::kEnablePluginPowerSaver) &&
module_->name() == kFlashPluginName && IsFlashPlugin(module_.get()) &&
power_saver_helper->ShouldThrottleContent( power_saver_helper->ShouldThrottleContent(
content_origin, bounds.width, bounds.height, &cross_origin); content_origin, bounds.width, bounds.height, &cross_origin);
...@@ -610,6 +614,11 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl( ...@@ -610,6 +614,11 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
if (GetContentClient()->renderer() && // NULL in unit tests. if (GetContentClient()->renderer() && // NULL in unit tests.
GetContentClient()->renderer()->IsExternalPepperPlugin(module->name())) GetContentClient()->renderer()->IsExternalPepperPlugin(module->name()))
external_document_load_ = true; external_document_load_ = true;
if (IsFlashPlugin(module_.get())) {
RenderThread::Get()->RecordAction(
base::UserMetricsAction("Flash.PluginInstanceCreated"));
}
} }
PepperPluginInstanceImpl::~PepperPluginInstanceImpl() { PepperPluginInstanceImpl::~PepperPluginInstanceImpl() {
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "content/public/renderer/document_state.h" #include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h" #include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/renderer/accessibility/renderer_accessibility.h" #include "content/renderer/accessibility/renderer_accessibility.h"
#include "content/renderer/browser_plugin/browser_plugin.h" #include "content/renderer/browser_plugin/browser_plugin.h"
#include "content/renderer/browser_plugin/browser_plugin_manager.h" #include "content/renderer/browser_plugin/browser_plugin_manager.h"
...@@ -664,6 +665,10 @@ RenderWidget* RenderFrameImpl::GetRenderWidget() { ...@@ -664,6 +665,10 @@ RenderWidget* RenderFrameImpl::GetRenderWidget() {
void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) {
FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
DidCreatePepperPlugin(host)); DidCreatePepperPlugin(host));
if (host->GetPluginName() == kFlashPluginName) {
RenderThread::Get()->RecordAction(
base::UserMetricsAction("FrameLoadWithFlash"));
}
} }
void RenderFrameImpl::PepperDidChangeCursor( void RenderFrameImpl::PepperDidChangeCursor(
...@@ -1672,7 +1677,7 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( ...@@ -1672,7 +1677,7 @@ blink::WebPlugin* RenderFrameImpl::createPlugin(
if (!found) if (!found)
return NULL; return NULL;
if (info.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) {
scoped_ptr<BrowserPluginDelegate> browser_plugin_delegate( scoped_ptr<BrowserPluginDelegate> browser_plugin_delegate(
GetContentClient()->renderer()->CreateBrowserPluginDelegate( GetContentClient()->renderer()->CreateBrowserPluginDelegate(
this, base::UTF16ToUTF8(params.mimeType))); this, base::UTF16ToUTF8(params.mimeType)));
...@@ -2628,9 +2633,9 @@ blink::WebColorChooser* RenderFrameImpl::createColorChooser( ...@@ -2628,9 +2633,9 @@ blink::WebColorChooser* RenderFrameImpl::createColorChooser(
const blink::WebVector<blink::WebColorSuggestion>& suggestions) { const blink::WebVector<blink::WebColorSuggestion>& suggestions) {
RendererWebColorChooserImpl* color_chooser = RendererWebColorChooserImpl* color_chooser =
new RendererWebColorChooserImpl(this, client); new RendererWebColorChooserImpl(this, client);
std::vector<content::ColorSuggestion> color_suggestions; std::vector<ColorSuggestion> color_suggestions;
for (size_t i = 0; i < suggestions.size(); i++) { for (size_t i = 0; i < suggestions.size(); i++) {
color_suggestions.push_back(content::ColorSuggestion(suggestions[i])); color_suggestions.push_back(ColorSuggestion(suggestions[i]));
} }
color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions); color_chooser->Open(static_cast<SkColor>(initial_color), color_suggestions);
return color_chooser; return color_chooser;
......
...@@ -2657,6 +2657,11 @@ should be able to be added at any place in this file. ...@@ -2657,6 +2657,11 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
</action> </action>
<action name="Flash.PluginInstanceCreated">
<owner>thestig@chromium.org</owner>
<description>Count of frame loads that also load PPAPI Flash.</description>
</action>
<action name="FocusAppMenu"> <action name="FocusAppMenu">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
...@@ -2942,6 +2947,16 @@ should be able to be added at any place in this file. ...@@ -2942,6 +2947,16 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
</action> </action>
<action name="FrameLoad">
<owner>thestig@chromium.org</owner>
<description>Count of successful frame loads to new pages.</description>
</action>
<action name="FrameLoadWithFlash">
<owner>thestig@chromium.org</owner>
<description>Count of frame loads that also load PPAPI Flash.</description>
</action>
<action name="Gesture_Overview"> <action name="Gesture_Overview">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment