| 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_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 class PepperWebPluginImpl; | 30 class PepperWebPluginImpl; |
| 31 class RenderFrameImpl; | 31 class RenderFrameImpl; |
| 32 | 32 |
| 33 class CONTENT_EXPORT PluginInstanceThrottlerImpl | 33 class CONTENT_EXPORT PluginInstanceThrottlerImpl |
| 34 : public PluginInstanceThrottler { | 34 : public PluginInstanceThrottler { |
| 35 public: | 35 public: |
| 36 PluginInstanceThrottlerImpl(); | 36 explicit PluginInstanceThrottlerImpl(bool record_decision); |
| 37 | 37 |
| 38 ~PluginInstanceThrottlerImpl() override; | 38 ~PluginInstanceThrottlerImpl() override; |
| 39 | 39 |
| 40 // PluginInstanceThrottler implementation: | 40 // PluginInstanceThrottler implementation: |
| 41 void AddObserver(Observer* observer) override; | 41 void AddObserver(Observer* observer) override; |
| 42 void RemoveObserver(Observer* observer) override; | 42 void RemoveObserver(Observer* observer) override; |
| 43 bool IsThrottled() const override; | 43 bool IsThrottled() const override; |
| 44 bool IsHiddenForPlaceholder() const override; | 44 bool IsHiddenForPlaceholder() const override; |
| 45 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override; | 45 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override; |
| 46 void SetHiddenForPlaceholder(bool hidden) override; | 46 void SetHiddenForPlaceholder(bool hidden) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 THROTTLER_STATE_MARKED_ESSENTIAL, | 83 THROTTLER_STATE_MARKED_ESSENTIAL, |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // Maximum number of frames to examine for a suitable keyframe. After that, we | 86 // Maximum number of frames to examine for a suitable keyframe. After that, we |
| 87 // simply suspend the plugin where it's at. Chosen arbitrarily. | 87 // simply suspend the plugin where it's at. Chosen arbitrarily. |
| 88 static const int kMaximumFramesToExamine; | 88 static const int kMaximumFramesToExamine; |
| 89 | 89 |
| 90 void AudioThrottledFrameTimeout(); | 90 void AudioThrottledFrameTimeout(); |
| 91 void EngageThrottle(); | 91 void EngageThrottle(); |
| 92 | 92 |
| 93 bool record_decision_; |
| 94 |
| 93 ThrottlerState state_; | 95 ThrottlerState state_; |
| 94 | 96 |
| 95 bool is_hidden_for_placeholder_; | 97 bool is_hidden_for_placeholder_; |
| 96 | 98 |
| 97 PepperWebPluginImpl* web_plugin_; | 99 PepperWebPluginImpl* web_plugin_; |
| 98 | 100 |
| 99 // Holds a reference to the last received frame. This doesn't actually copy | 101 // Holds a reference to the last received frame. This doesn't actually copy |
| 100 // the pixel data, but rather increments the reference count to the pixels. | 102 // the pixel data, but rather increments the reference count to the pixels. |
| 101 SkBitmap last_received_frame_; | 103 SkBitmap last_received_frame_; |
| 102 | 104 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 | 115 |
| 114 base::ObserverList<Observer> observer_list_; | 116 base::ObserverList<Observer> observer_list_; |
| 115 | 117 |
| 116 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; | 118 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; |
| 117 | 119 |
| 118 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); | 120 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); |
| 119 }; | 121 }; |
| 120 } | 122 } |
| 121 | 123 |
| 122 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ | 124 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ |
| OLD | NEW |