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

Unified Diff: chrome/renderer/plugins/chrome_plugin_placeholder.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: 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: 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 c532fdd2c2c7c3e23014a9160373e77cf3429683..402bfb6f3e87fa1701962e94f540962cd2ba6d6e 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"
@@ -366,6 +367,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());
+}
+
gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return LoadablePluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod(
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.h ('k') | chrome/test/data/prerender/plugin_delay_load.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698