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