OLD | NEW |
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_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class CONTENT_EXPORT PepperPluginInstanceThrottler { | 45 class CONTENT_EXPORT PepperPluginInstanceThrottler { |
46 public: | 46 public: |
47 PepperPluginInstanceThrottler(PluginPowerSaverHelper* power_saver_helper, | 47 PepperPluginInstanceThrottler(PluginPowerSaverHelper* power_saver_helper, |
48 const blink::WebRect& bounds, | 48 const blink::WebRect& bounds, |
49 const std::string& module_name, | 49 const std::string& module_name, |
50 const GURL& plugin_url, | 50 const GURL& plugin_url, |
51 const base::Closure& throttle_change_callback); | 51 const base::Closure& throttle_change_callback); |
52 | 52 |
53 virtual ~PepperPluginInstanceThrottler(); | 53 virtual ~PepperPluginInstanceThrottler(); |
54 | 54 |
| 55 bool needs_representative_keyframe() const { |
| 56 return needs_representative_keyframe_; |
| 57 } |
| 58 |
55 // Called when the plugin flushes it's graphics context. Supplies the | 59 // Called when the plugin flushes it's graphics context. Supplies the |
56 // throttler with a candidate to use as the representative keyframe. | 60 // throttler with a candidate to use as the representative keyframe. |
57 void OnImageFlush(const SkBitmap* bitmap); | 61 void OnImageFlush(const SkBitmap* bitmap); |
58 | 62 |
59 bool is_throttled() const { return plugin_throttled_; } | 63 bool is_throttled() const { return plugin_throttled_; } |
60 const ppapi::ViewData& throttled_view_data() const { | 64 const ppapi::ViewData& throttled_view_data() const { |
61 return empty_view_data_; | 65 return empty_view_data_; |
62 } | 66 } |
63 | 67 |
64 // Returns true if |event| was handled and shouldn't be further processed. | 68 // Returns true if |event| was handled and shouldn't be further processed. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Fake view data used by the Power Saver feature to throttle plugins. | 106 // Fake view data used by the Power Saver feature to throttle plugins. |
103 const ppapi::ViewData empty_view_data_; | 107 const ppapi::ViewData empty_view_data_; |
104 | 108 |
105 base::WeakPtrFactory<PepperPluginInstanceThrottler> weak_factory_; | 109 base::WeakPtrFactory<PepperPluginInstanceThrottler> weak_factory_; |
106 | 110 |
107 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceThrottler); | 111 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceThrottler); |
108 }; | 112 }; |
109 } | 113 } |
110 | 114 |
111 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ | 115 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ |
OLD | NEW |