OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 public: | 63 public: |
64 virtual void OnThrottleStateChange() = 0; | 64 virtual void OnThrottleStateChange() = 0; |
65 }; | 65 }; |
66 | 66 |
67 // Returns a nullptr if no throttler needed based on |power_saver_mode|. | 67 // Returns a nullptr if no throttler needed based on |power_saver_mode|. |
68 static scoped_ptr<PluginInstanceThrottler> Get( | 68 static scoped_ptr<PluginInstanceThrottler> Get( |
69 RenderFrame* frame, | 69 RenderFrame* frame, |
70 const GURL& plugin_url, | 70 const GURL& plugin_url, |
71 PluginPowerSaverMode power_saver_mode); | 71 PluginPowerSaverMode power_saver_mode); |
72 | 72 |
| 73 static void RecordUnthrottleMethodMetric(PowerSaverUnthrottleMethod method); |
| 74 |
73 virtual ~PluginInstanceThrottler() {} | 75 virtual ~PluginInstanceThrottler() {} |
74 | 76 |
75 virtual void AddObserver(Observer* observer) = 0; | 77 virtual void AddObserver(Observer* observer) = 0; |
76 virtual void RemoveObserver(Observer* observer) = 0; | 78 virtual void RemoveObserver(Observer* observer) = 0; |
77 | 79 |
78 virtual bool IsThrottled() const = 0; | 80 virtual bool IsThrottled() const = 0; |
79 | 81 |
80 // Marks the plugin as essential. Unthrottles the plugin if already throttled. | 82 // Marks the plugin as essential. Unthrottles the plugin if already throttled. |
81 virtual void MarkPluginEssential(PowerSaverUnthrottleMethod method) = 0; | 83 virtual void MarkPluginEssential(PowerSaverUnthrottleMethod method) = 0; |
82 | 84 |
83 protected: | 85 protected: |
84 PluginInstanceThrottler() {} | 86 PluginInstanceThrottler() {} |
85 | 87 |
86 private: | 88 private: |
87 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottler); | 89 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottler); |
88 }; | 90 }; |
89 } | 91 } |
90 | 92 |
91 #endif // CONTENT_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ | 93 #endif // CONTENT_PUBLIC_RENDERER_PLUGIN_INSTANCE_THROTTLER_H_ |
OLD | NEW |