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

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl.cc

Issue 1015023002: Plugin Power Saver: Throttle 'large' plugins that appear small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: content/renderer/pepper/plugin_instance_throttler_impl.cc
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl.cc b/content/renderer/pepper/plugin_instance_throttler_impl.cc
index 1ff6248f3b349d75a7aa60f9b6b82bace08566e8..49b497f2dc0db171f2e49607c8d0b85bb3dc884a 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
@@ -53,6 +53,8 @@ PluginInstanceThrottlerImpl::PluginInstanceThrottlerImpl(
web_plugin_(nullptr),
consecutive_interesting_frames_(0),
frames_examined_(0),
+ initialized_width_(0),
+ initialized_height_(0),
weak_factory_(this) {
}
@@ -101,6 +103,14 @@ blink::WebPlugin* PluginInstanceThrottlerImpl::GetWebPlugin() const {
return web_plugin_;
}
+int PluginInstanceThrottlerImpl::GetWidth() const {
+ return initialized_width_;
+}
+
+int PluginInstanceThrottlerImpl::GetHeight() const {
+ return initialized_height_;
+}
+
void PluginInstanceThrottlerImpl::SetWebPlugin(blink::WebPlugin* web_plugin) {
DCHECK(!web_plugin_);
web_plugin_ = web_plugin;
@@ -110,13 +120,17 @@ void PluginInstanceThrottlerImpl::Initialize(
RenderFrameImpl* frame,
const GURL& content_origin,
const std::string& plugin_module_name,
- const blink::WebRect& bounds) {
+ int width,
+ int height) {
+ initialized_width_ = width;
+ initialized_height_ = height;
+
// |frame| may be nullptr in tests.
if (frame) {
PluginPowerSaverHelper* helper = frame->plugin_power_saver_helper();
bool cross_origin_main_content = false;
if (!helper->ShouldThrottleContent(content_origin, plugin_module_name,
- bounds.width, bounds.height,
+ width, height,
&cross_origin_main_content)) {
state_ = THROTTLER_STATE_MARKED_ESSENTIAL;

Powered by Google App Engine
This is Rietveld 408576698