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

Side by Side Diff: content/renderer/pepper/plugin_power_saver_helper_impl.h

Issue 764763005: Plugin Power Saver: Always mark 'tiny' plugins as essential. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0201-plugin-power-saver-use-poster-frame-on-blocked-only
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 // PluginPluginPowerSaverHelper implementation. 25 // PluginPluginPowerSaverHelper implementation.
26 GURL GetPluginInstancePosterImage(const blink::WebPluginParams& params, 26 GURL GetPluginInstancePosterImage(const blink::WebPluginParams& params,
27 const GURL& base_url) const override; 27 const GURL& base_url) const override;
28 void RegisterPeripheralPlugin( 28 void RegisterPeripheralPlugin(
29 const GURL& content_origin, 29 const GURL& content_origin,
30 const base::Closure& unthrottle_callback) override; 30 const base::Closure& unthrottle_callback) override;
31 31
32 // Returns true if this plugin should have power saver enabled. 32 // Returns true if this plugin should have power saver enabled.
33 // 33 //
34 // Power Saver is enabled for plugin content that are cross-origin and 34 // Power Saver is enabled for plugin content that are cross-origin and
35 // heuristically determined to be not the "main attraction" of the webpage. 35 // heuristically determined to be not essential to the web page content.
36 // 36 //
37 // Plugin content is defined to be cross-origin when the plugin source's 37 // Plugin content is defined to be cross-origin when the plugin source's
38 // origin differs from the top level frame's origin. For example: 38 // origin differs from the top level frame's origin. For example:
39 // - Cross-origin: a.com -> b.com/plugin.swf 39 // - Cross-origin: a.com -> b.com/plugin.swf
40 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf 40 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf
41 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf 41 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf
42 // 42 //
43 // |cross_origin| may not be NULL. 43 // |is_main_attraction| may be NULL. It is set to true if the plugin content
44 // is cross-origin and determined to be the "main attraction" of the page.
44 // 45 //
45 // Virtual to allow overriding in tests. 46 // Virtual to allow overriding in tests.
46 virtual bool ShouldThrottleContent(const GURL& content_origin, 47 virtual bool ShouldThrottleContent(const GURL& content_origin,
47 int width, 48 int width,
48 int height, 49 int height,
49 bool* cross_origin) const; 50 bool* is_main_attraction) const;
50 51
51 // Virtual to allow overriding in tests. 52 // Virtual to allow overriding in tests.
52 virtual void WhitelistContentOrigin(const GURL& content_origin); 53 virtual void WhitelistContentOrigin(const GURL& content_origin);
53 54
54 private: 55 private:
55 struct PeripheralPlugin { 56 struct PeripheralPlugin {
56 PeripheralPlugin(const GURL& content_origin, 57 PeripheralPlugin(const GURL& content_origin,
57 const base::Closure& unthrottle_callback); 58 const base::Closure& unthrottle_callback);
58 ~PeripheralPlugin(); 59 ~PeripheralPlugin();
59 60
(...skipping 13 matching lines...) Expand all
73 74
74 // Set of peripheral plugins eligible to be unthrottled ex post facto. 75 // Set of peripheral plugins eligible to be unthrottled ex post facto.
75 std::vector<PeripheralPlugin> peripheral_plugins_; 76 std::vector<PeripheralPlugin> peripheral_plugins_;
76 77
77 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelperImpl); 78 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelperImpl);
78 }; 79 };
79 80
80 } // namespace content 81 } // namespace content
81 82
82 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ 83 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698