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

Unified Diff: components/plugins/renderer/loadable_plugin_placeholder.h

Issue 1124173008: Plugin Power Saver: Unthrottle dynamically sized plugins correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/loadable_plugin_placeholder.h
diff --git a/components/plugins/renderer/loadable_plugin_placeholder.h b/components/plugins/renderer/loadable_plugin_placeholder.h
index 7683ba7c6d8a081c1c7116859c449a061552a52c..a741cc082d4c36bc5209f00b5567c90ff0a2557c 100644
--- a/components/plugins/renderer/loadable_plugin_placeholder.h
+++ b/components/plugins/renderer/loadable_plugin_placeholder.h
@@ -85,6 +85,9 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
void PluginDestroyed() override;
v8::Local<v8::Object> GetV8ScriptableObject(
v8::Isolate* isolate) const override;
+#if defined(ENABLE_PLUGINS)
groby-ooo-7-16 2015/06/11 23:32:56 Question - why do we need to ENABLE_PLUGINS for *p
tommycli 2015/06/11 23:39:21 Because previously a ChromePluginPlaceholder was u
+ void OnUnobscuredSizeUpdate(const gfx::Size& unobscured_size) override;
+#endif
// RenderFrameObserver methods:
void WasShown() override;
@@ -97,6 +100,9 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
void UpdateMessage();
bool LoadingBlocked() const;
+#if defined(ENABLE_PLUGINS)
+ void RecheckSizeAndMaybeUnthrottle();
+#endif
// Plugin creation is embedder-specific.
virtual blink::WebPlugin* CreatePlugin() = 0;
@@ -129,6 +135,14 @@ class LoadablePluginPlaceholder : public PluginPlaceholder {
bool finished_loading_;
std::string identifier_;
+ // Used to prevent re-entrancy during the size recheck for throttled plugins.
+ bool in_size_recheck_;
+ gfx::Size unobscured_size_;
+
+ // A separate weak factory so we can schedule, coalesce and cancel unthrottle
+ // calls due to plugin size updates.
+ base::WeakPtrFactory<LoadablePluginPlaceholder> size_update_weak_factory_;
+
base::WeakPtrFactory<LoadablePluginPlaceholder> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(LoadablePluginPlaceholder);

Powered by Google App Engine
This is Rietveld 408576698