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

Unified Diff: content/public/renderer/render_frame.h

Issue 1497623002: Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/public/renderer/render_frame.h
diff --git a/content/public/renderer/render_frame.h b/content/public/renderer/render_frame.h
index 2011c4e694752e658a26e4f7a9c0c2feb724a7d6..dc055ef24ade5f75e7bb16908ddf43a312cdc3b0 100644
--- a/content/public/renderer/render_frame.h
+++ b/content/public/renderer/render_frame.h
@@ -29,6 +29,7 @@ struct WebPluginParams;
namespace gfx {
class Range;
+class Size;
}
namespace url {
@@ -56,6 +57,24 @@ struct WebPreferences;
class CONTENT_EXPORT RenderFrame : public IPC::Listener,
public IPC::Sender {
public:
+ // These numeric values are used in UMA logs; do not change them.
+ enum PeripheralContentStatus {
+ // Content is peripheral because it doesn't meet any of the below criteria.
+ CONTENT_STATUS_PERIPHERAL = 0,
+ // Content is essential because it's same-origin with the top-level frame.
+ CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN = 1,
+ // Content is essential even though it's cross-origin, because it's large.
+ CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG = 2,
+ // Content is essential because there's large content from the same origin.
+ CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3,
+ // Content is essential because it's tiny in size.
+ CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY = 4,
+ // Content is essential because it has an unknown size.
+ CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE = 5,
+ // Must be last.
+ CONTENT_STATUS_NUM_ITEMS
+ };
+
// Returns the RenderFrame given a WebFrame.
static RenderFrame* FromWebFrame(blink::WebFrame* web_frame);
@@ -131,7 +150,7 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener,
const url::Origin& content_origin,
const base::Closure& unthrottle_callback) = 0;
- // Returns true if this plugin should have power saver enabled.
+ // Returns the peripheral content heuristic decision.
//
// Power Saver is enabled for plugin content that are cross-origin and
// heuristically determined to be not essential to the web page content.
@@ -146,15 +165,11 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener,
//
// |content_origin| is the origin of the plugin content.
//
- // |width| and |height| are zoom and device scale independent logical pixels.
- //
- // |cross_origin_main_content| may be NULL. It is set to true if the
- // plugin content is cross-origin but still the "main attraction" of the page.
- virtual bool ShouldThrottleContent(const url::Origin& main_frame_origin,
- const url::Origin& content_origin,
- int width,
- int height,
- bool* cross_origin_main_content) const = 0;
+ // |unobscured_size| are zoom and device scale independent logical pixels.
+ virtual PeripheralContentStatus GetPeripheralContentStatus(
+ const url::Origin& main_frame_origin,
+ const url::Origin& content_origin,
+ const gfx::Size& unobscured_size) const = 0;
// Whitelists a |content_origin| so its content will never be throttled in
// this RenderFrame. Whitelist is cleared by top level navigation.
« no previous file with comments | « components/plugins/renderer/loadable_plugin_placeholder.cc ('k') | content/renderer/pepper/plugin_instance_throttler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698