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

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

Issue 849723002: Plugin Power Saver: Make PepperPluginInstanceThrottler interface public. (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: components/plugins/renderer/plugin_placeholder.cc
diff --git a/components/plugins/renderer/plugin_placeholder.cc b/components/plugins/renderer/plugin_placeholder.cc
index 09b27381df3ff2c32097bcb84d1534c5205f8d0b..ed20d4a170036efb4005e47c8108d870f0068cd0 100644
--- a/components/plugins/renderer/plugin_placeholder.cc
+++ b/components/plugins/renderer/plugin_placeholder.cc
@@ -35,6 +35,7 @@ using blink::WebPluginContainer;
using blink::WebPluginParams;
using blink::WebScriptSource;
using blink::WebURLRequest;
+using content::PluginPowerSaverMode;
using content::RenderThread;
namespace plugins {
@@ -68,7 +69,7 @@ PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame,
is_blocked_for_background_tab_(false),
is_blocked_for_prerendering_(false),
is_blocked_for_power_saver_poster_(false),
- power_saver_mode_(content::RenderFrame::POWER_SAVER_MODE_ESSENTIAL),
+ power_saver_mode_(PluginPowerSaverMode::POWER_SAVER_MODE_ESSENTIAL),
allow_loading_(false),
hidden_(false),
finished_loading_(false),
@@ -79,7 +80,7 @@ PluginPlaceholder::~PluginPlaceholder() {}
#if defined(ENABLE_PLUGINS)
void PluginPlaceholder::DisablePowerSaverForInstance() {
- power_saver_mode_ = content::RenderFrame::POWER_SAVER_MODE_ESSENTIAL;
+ power_saver_mode_ = PluginPowerSaverMode::POWER_SAVER_MODE_ESSENTIAL;
if (is_blocked_for_power_saver_poster_) {
is_blocked_for_power_saver_poster_ = false;
if (!LoadingBlocked())
@@ -247,11 +248,18 @@ void PluginPlaceholder::LoadPlugin() {
return;
}
+#if defined(ENABLE_PLUGINS)
Lei Zhang 2015/01/16 01:09:58 Can you see if this works for platforms without EN
tommycli 2015/01/16 01:26:10 Done.
+ WebPlugin* plugin = render_frame()->CreatePlugin(
+ frame_, plugin_info_, plugin_params_,
+ content::PluginInstanceThrottler::Get(render_frame(), plugin_params_.url,
+ power_saver_mode_));
+#else
+ WebPlugin* plugin = render_frame()->CreatePlugin(frame_, plugin_info_,
+ plugin_params_, nullptr);
+#endif
// TODO(mmenke): In the case of prerendering, feed into
Lei Zhang 2015/01/16 01:09:58 Is this referring to the CreatePlugin() calls, whi
tommycli 2015/01/16 01:26:10 Done.
// ChromeContentRendererClient::CreatePlugin instead, to
// reduce the chance of future regressions.
- WebPlugin* plugin = render_frame()->CreatePlugin(
- frame_, plugin_info_, plugin_params_, power_saver_mode_);
ReplacePlugin(plugin);
}

Powered by Google App Engine
This is Rietveld 408576698