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

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl.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_instance_throttler_impl.cc
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl.cc b/content/renderer/pepper/plugin_instance_throttler_impl.cc
index 10c7f50593eb113ec5348e0a8613db4a9052fb5c..1fee2786728a57f78661c45903e058d9bd56a408 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
@@ -41,8 +41,9 @@ const int kAudioThrottledFrameTimeoutMilliseconds = 500;
const int PluginInstanceThrottlerImpl::kMaximumFramesToExamine = 150;
// static
-std::unique_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Create() {
- return base::WrapUnique(new PluginInstanceThrottlerImpl);
+std::unique_ptr<PluginInstanceThrottler> PluginInstanceThrottler::Create(
+ RenderFrame::RecordPeripheralDecision record_decision) {
+ return base::WrapUnique(new PluginInstanceThrottlerImpl(record_decision));
}
// static
@@ -53,8 +54,10 @@ void PluginInstanceThrottler::RecordUnthrottleMethodMetric(
PluginInstanceThrottler::UNTHROTTLE_METHOD_NUM_ITEMS);
}
-PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl()
- : state_(THROTTLER_STATE_AWAITING_KEYFRAME),
+PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl(
+ content::RenderFrame::RecordPeripheralDecision record_decision)
+ : record_decision_(record_decision),
+ state_(THROTTLER_STATE_AWAITING_KEYFRAME),
is_hidden_for_placeholder_(false),
web_plugin_(nullptr),
frames_examined_(0),
@@ -65,8 +68,7 @@ PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl()
kAudioThrottledFrameTimeoutMilliseconds),
this,
&PluginInstanceThrottlerImpl::EngageThrottle),
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
PluginInstanceThrottlerImpl::~PluginInstanceThrottlerImpl() {
FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottlerDestroyed());
@@ -144,7 +146,8 @@ void PluginInstanceThrottlerImpl::Initialize(
auto status = frame->GetPeripheralContentStatus(
frame->GetWebFrame()->top()->getSecurityOrigin(), content_origin,
gfx::Size(roundf(unobscured_size.width() / zoom_factor),
- roundf(unobscured_size.height() / zoom_factor)));
+ roundf(unobscured_size.height() / zoom_factor)),
+ record_decision_);
if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL) {
DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_);
state_ = THROTTLER_STATE_MARKED_ESSENTIAL;

Powered by Google App Engine
This is Rietveld 408576698