Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc |
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
index 6b60c3bae374b993c3ef34d0af5d53d96f292ebb..02fd743f771389f47da8ce483fcd867b277949c4 100644 |
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/grit/renderer_resources.h" |
#include "chrome/renderer/chrome_content_renderer_client.h" |
#include "chrome/renderer/custom_menu_commands.h" |
+#include "chrome/renderer/plugins/plugin_preroller.h" |
#include "chrome/renderer/plugins/plugin_uma.h" |
#include "components/content_settings/content/common/content_settings_messages.h" |
#include "content/app/strings/grit/content_strings.h" |
@@ -368,6 +369,24 @@ void ChromePluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) { |
#endif // OS_ANDROID |
} |
+blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() { |
+ scoped_ptr<content::PluginInstanceThrottler> throttler; |
+#if defined(ENABLE_PLUGINS) |
+ // If the plugin has already been marked essential in its placeholder form, |
+ // we shouldn't create a new throttler and start the process all over again. |
+ if (power_saver_enabled()) { |
+ throttler = content::PluginInstanceThrottler::Create(); |
+ // PluginPreroller manages its own lifetime. |
+ new PluginPreroller(render_frame(), GetFrame(), GetPluginParams(), |
+ GetPluginInfo(), GetIdentifier(), title_, |
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), |
+ throttler.get()); |
+ } |
+#endif |
+ return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(), |
+ GetPluginParams(), throttler.Pass()); |
+} |
+ |
void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { |
v8::Isolate* isolate = blink::mainThreadIsolate(); |
v8::HandleScope handle_scope(isolate); |