Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: components/plugins/renderer/loadable_plugin_placeholder.cc

Issue 2211753002: Plugin Power Saver Tiny: Fix Plugin.PowerSaver.PeripheralHeuristic UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/plugins/renderer/loadable_plugin_placeholder.cc
diff --git a/components/plugins/renderer/loadable_plugin_placeholder.cc b/components/plugins/renderer/loadable_plugin_placeholder.cc
index 7d50eecaf8112ca14a78ce2bfefb8e6f5cabf90c..3ef70deb0c621a88af63b43beb945eda892d3a53 100644
--- a/components/plugins/renderer/loadable_plugin_placeholder.cc
+++ b/components/plugins/renderer/loadable_plugin_placeholder.cc
@@ -51,6 +51,7 @@ void LoadablePluginPlaceholder::SetPremadePlugin(
content::PluginInstanceThrottler* throttler) {
DCHECK(throttler);
DCHECK(!premade_throttler_);
+ heuristic_run_before_ = true;
premade_throttler_ = throttler;
}
@@ -60,6 +61,7 @@ LoadablePluginPlaceholder::LoadablePluginPlaceholder(
const blink::WebPluginParams& params,
const std::string& html_data)
: PluginPlaceholderBase(render_frame, frame, params, html_data),
+ heuristic_run_before_(false),
is_blocked_for_tinyness_(false),
is_blocked_for_background_tab_(false),
is_blocked_for_prerendering_(false),
@@ -68,7 +70,6 @@ LoadablePluginPlaceholder::LoadablePluginPlaceholder(
premade_throttler_(nullptr),
allow_loading_(false),
finished_loading_(false),
- heuristic_run_before_(premade_throttler_ != nullptr),
weak_factory_(this) {}
LoadablePluginPlaceholder::~LoadablePluginPlaceholder() {
@@ -202,7 +203,8 @@ void LoadablePluginPlaceholder::OnUnobscuredRectUpdate(
content::RenderFrame::PeripheralContentStatus status =
render_frame()->GetPeripheralContentStatus(
render_frame()->GetWebFrame()->top()->getSecurityOrigin(),
- content_origin, gfx::Size(width, height));
+ content_origin, gfx::Size(width, height),
+ !heuristic_run_before_ /* record_decision */);
bool plugin_is_tiny_and_blocked =
is_blocked_for_tinyness_ &&

Powered by Google App Engine
This is Rietveld 408576698