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

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl.cc

Issue 879403002: Plugin Power Saver: Mute throttled plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 a95f6db47aef47039b6c9696a87917f53b36f5da..e9562c4354978d34f122bd445b15c2d9ca3c6eb6 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
@@ -78,7 +78,7 @@ PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl(
}
PluginInstanceThrottlerImpl::~PluginInstanceThrottlerImpl() {
- if (state_ != PLUGIN_INSTANCE_MARKED_ESSENTIAL)
+ if (state_ != POWER_SAVER_MARKED_ESSENTIAL)
RecordUnthrottleMethodMetric(UNTHROTTLE_METHOD_NEVER);
}
@@ -96,15 +96,12 @@ bool PluginInstanceThrottlerImpl::IsThrottled() const {
void PluginInstanceThrottlerImpl::MarkPluginEssential(
PowerSaverUnthrottleMethod method) {
- if (state_ == PLUGIN_INSTANCE_MARKED_ESSENTIAL)
+ if (state_ == POWER_SAVER_MARKED_ESSENTIAL)
return;
- bool was_throttled = IsThrottled();
- state_ = PLUGIN_INSTANCE_MARKED_ESSENTIAL;
+ state_ = POWER_SAVER_MARKED_ESSENTIAL;
RecordUnthrottleMethodMetric(method);
-
- if (was_throttled)
- FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnPowerSaverStateChange(state_));
}
void PluginInstanceThrottlerImpl::OnImageFlush(const SkBitmap* bitmap) {
@@ -131,7 +128,7 @@ bool PluginInstanceThrottlerImpl::ConsumeInputEvent(
if (event.modifiers & blink::WebInputEvent::Modifiers::RightButtonDown)
return false;
- if (state_ != PLUGIN_INSTANCE_MARKED_ESSENTIAL &&
+ if (state_ != POWER_SAVER_MARKED_ESSENTIAL &&
event.type == blink::WebInputEvent::MouseUp &&
(event.modifiers & blink::WebInputEvent::LeftButtonDown)) {
bool was_throttled = IsThrottled();
@@ -147,7 +144,7 @@ void PluginInstanceThrottlerImpl::EngageThrottle() {
return;
state_ = POWER_SAVER_ENABLED_PLUGIN_THROTTLED;
- FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnPowerSaverStateChange(state_));
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698