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

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

Issue 1114623002: Plugin Power Saver: Make PPS work well with prerendered pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 8 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 593fb99d7fadb924a36c0e4cd68100d9ef121719..b1918d966cedf8cd07c9d30aca225a8722b109c7 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
@@ -102,7 +102,7 @@ void PluginInstanceThrottlerImpl::MarkPluginEssential(
RecordUnthrottleMethodMetric(method);
if (was_throttled)
- FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
+ BroadcastThrottleStateChange();
// Notify the Power Saver test plugin of a peripheral status change.
if (web_plugin_ && web_plugin_->instance() &&
@@ -229,7 +229,19 @@ void PluginInstanceThrottlerImpl::EngageThrottle() {
}
state_ = THROTTLER_STATE_PLUGIN_THROTTLED;
+ BroadcastThrottleStateChange();
+}
+
+void PluginInstanceThrottlerImpl::BroadcastThrottleStateChange() {
FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange());
+
+ // Notify the Power Saver test plugin of a throttle status change.
+ if (web_plugin_ && web_plugin_->instance() &&
+ plugin_module_name_ == ppapi::kPowerSaverTestPluginName) {
+ web_plugin_->instance()->HandleMessage(ppapi::ScopedPPVar(
+ ppapi::ScopedPPVar::PassRef(),
+ ppapi::StringVar::StringToPPVar("throttleStatusChange")));
+ }
raymes 2015/04/29 00:12:34 It feels a little weird to have this test code in
tommycli 2015/04/29 20:25:47 Done.
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698