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

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: 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: 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);

Powered by Google App Engine
This is Rietveld 408576698