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

Unified Diff: content/renderer/pepper/plugin_power_saver_helper.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: merge. and change to enum 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: content/renderer/pepper/plugin_power_saver_helper.cc
diff --git a/content/renderer/pepper/plugin_power_saver_helper.cc b/content/renderer/pepper/plugin_power_saver_helper.cc
index 1879b7e9fe26415d0262a7b7e8fd9da7cace071f..e0969fd83a202dce3d0b9fd97ec0915b779f96ca 100644
--- a/content/renderer/pepper/plugin_power_saver_helper.cc
+++ b/content/renderer/pepper/plugin_power_saver_helper.cc
@@ -25,7 +25,7 @@ namespace content {
namespace {
const char kPeripheralHeuristicHistogram[] =
- "Plugin.PowerSaver.PeripheralHeuristic";
+ "Plugin.PowerSaver.PeripheralHeuristicInitialDecision";
} // namespace
@@ -102,7 +102,8 @@ RenderFrame::PeripheralContentStatus
PluginPowerSaverHelper::GetPeripheralContentStatus(
const url::Origin& main_frame_origin,
const url::Origin& content_origin,
- const gfx::Size& unobscured_size) const {
+ const gfx::Size& unobscured_size,
+ RenderFrame::RecordPeripheralDecision record_decision) const {
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kOverridePluginPowerSaverForTesting) == "always") {
return RenderFrame::CONTENT_STATUS_PERIPHERAL;
@@ -110,15 +111,14 @@ PluginPowerSaverHelper::GetPeripheralContentStatus(
auto status = PeripheralContentHeuristic::GetPeripheralStatus(
origin_whitelist_, main_frame_origin, content_origin, unobscured_size);
- if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE) {
- // Early exit here to avoid recording a UMA. Every plugin will call this
- // method once before the size is known (to faciliate early-exit for
- // same-origin and whitelisted-origin content).
- return status;
+
+ // Never record ESSENTIAL_UNKNOWN_SIZE. Wait for retest after size is known.
+ if (record_decision == RenderFrame::RECORD_DECISION &&
+ status != RenderFrame::CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE) {
+ UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, status,
+ RenderFrame::CONTENT_STATUS_NUM_ITEMS);
}
- UMA_HISTOGRAM_ENUMERATION(kPeripheralHeuristicHistogram, status,
- RenderFrame::CONTENT_STATUS_NUM_ITEMS);
return status;
}
« no previous file with comments | « content/renderer/pepper/plugin_power_saver_helper.h ('k') | content/renderer/pepper/plugin_power_saver_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698