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

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

Issue 1114623002: Plugin Power Saver: Make PPS work well with prerendered pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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_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"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/renderer/plugin_instance_throttler.h" 13 #include "content/public/renderer/plugin_instance_throttler.h"
14 #include "content/renderer/pepper/pepper_webplugin_impl.h"
14 #include "ppapi/shared_impl/ppb_view_shared.h" 15 #include "ppapi/shared_impl/ppb_view_shared.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
17 18
18 namespace blink { 19 namespace blink {
19 class WebInputEvent; 20 class WebInputEvent;
20 struct WebRect; 21 struct WebRect;
21 } 22 }
22 23
23 namespace content { 24 namespace content {
24 25
25 class PepperWebPluginImpl; 26 class PepperWebPluginImpl;
26 class RenderFrameImpl; 27 class RenderFrameImpl;
27 28
28 class CONTENT_EXPORT PluginInstanceThrottlerImpl 29 class CONTENT_EXPORT PluginInstanceThrottlerImpl
29 : public PluginInstanceThrottler { 30 : public PluginInstanceThrottler {
30 public: 31 public:
31 PluginInstanceThrottlerImpl(); 32 PluginInstanceThrottlerImpl();
32 33
33 ~PluginInstanceThrottlerImpl() override; 34 ~PluginInstanceThrottlerImpl() override;
34 35
35 // PluginInstanceThrottler implementation: 36 // PluginInstanceThrottler implementation:
36 void AddObserver(Observer* observer) override; 37 void AddObserver(Observer* observer) override;
37 void RemoveObserver(Observer* observer) override; 38 void RemoveObserver(Observer* observer) override;
38 bool IsThrottled() const override; 39 bool IsThrottled() const override;
39 bool IsHiddenForPlaceholder() const override; 40 bool IsHiddenForPlaceholder() const override;
40 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override; 41 void MarkPluginEssential(PowerSaverUnthrottleMethod method) override;
41 void SetHiddenForPlaceholder(bool hidden) override; 42 void SetHiddenForPlaceholder(bool hidden) override;
42 blink::WebPlugin* GetWebPlugin() const override; 43 PepperWebPluginImpl* GetWebPlugin() const override;
43 const gfx::Size& GetSize() const override; 44 const gfx::Size& GetSize() const override;
44 void NotifyAudioThrottled() override; 45 void NotifyAudioThrottled() override;
45 46
46 void SetWebPlugin(PepperWebPluginImpl* web_plugin); 47 void SetWebPlugin(PepperWebPluginImpl* web_plugin);
47 48
48 bool needs_representative_keyframe() const { 49 bool needs_representative_keyframe() const {
49 return state_ == THROTTLER_STATE_AWAITING_KEYFRAME; 50 return state_ == THROTTLER_STATE_AWAITING_KEYFRAME;
50 } 51 }
51 52
52 bool power_saver_enabled() const { 53 bool power_saver_enabled() const {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Holds a reference to the last received frame. This doesn't actually copy 95 // Holds a reference to the last received frame. This doesn't actually copy
95 // the pixel data, but rather increments the reference count to the pixels. 96 // the pixel data, but rather increments the reference count to the pixels.
96 SkBitmap last_received_frame_; 97 SkBitmap last_received_frame_;
97 98
98 // Number of consecutive interesting frames we've encountered. 99 // Number of consecutive interesting frames we've encountered.
99 int consecutive_interesting_frames_; 100 int consecutive_interesting_frames_;
100 101
101 // Number of frames we've examined to find a keyframe. 102 // Number of frames we've examined to find a keyframe.
102 int frames_examined_; 103 int frames_examined_;
103 104
104 // Plugin module name as of initialization.
105 std::string plugin_module_name_;
106
107 // Plugin's unobscured dimensions as of initialization. 105 // Plugin's unobscured dimensions as of initialization.
108 gfx::Size unobscured_size_; 106 gfx::Size unobscured_size_;
109 107
110 // Video plugins with throttled audio often stop generating frames. 108 // Video plugins with throttled audio often stop generating frames.
111 // This timer is so we don't wait forever for candidate poster frames. 109 // This timer is so we don't wait forever for candidate poster frames.
112 bool audio_throttled_; 110 bool audio_throttled_;
113 base::DelayTimer<PluginInstanceThrottlerImpl> audio_throttled_frame_timeout_; 111 base::DelayTimer<PluginInstanceThrottlerImpl> audio_throttled_frame_timeout_;
114 112
115 ObserverList<Observer> observer_list_; 113 ObserverList<Observer> observer_list_;
116 114
117 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; 115 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_;
118 116
119 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); 117 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl);
120 }; 118 };
121 } 119 }
122 120
123 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ 121 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698