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" |
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 "content/renderer/pepper/pepper_webplugin_impl.h" |
15 #include "ppapi/shared_impl/ppb_view_shared.h" | 15 #include "ppapi/shared_impl/ppb_view_shared.h" |
16 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class WebInputEvent; | 20 class WebInputEvent; |
21 struct WebRect; | 21 struct WebRect; |
22 } | 22 } |
23 | 23 |
| 24 namespace url { |
| 25 class Origin; |
| 26 } |
| 27 |
24 namespace content { | 28 namespace content { |
25 | 29 |
26 class PepperWebPluginImpl; | 30 class PepperWebPluginImpl; |
27 class RenderFrameImpl; | 31 class RenderFrameImpl; |
28 | 32 |
29 class CONTENT_EXPORT PluginInstanceThrottlerImpl | 33 class CONTENT_EXPORT PluginInstanceThrottlerImpl |
30 : public PluginInstanceThrottler { | 34 : public PluginInstanceThrottler { |
31 public: | 35 public: |
32 PluginInstanceThrottlerImpl(); | 36 PluginInstanceThrottlerImpl(); |
33 | 37 |
(...skipping 14 matching lines...) Expand all Loading... |
48 | 52 |
49 bool needs_representative_keyframe() const { | 53 bool needs_representative_keyframe() const { |
50 return state_ == THROTTLER_STATE_AWAITING_KEYFRAME; | 54 return state_ == THROTTLER_STATE_AWAITING_KEYFRAME; |
51 } | 55 } |
52 | 56 |
53 bool power_saver_enabled() const { | 57 bool power_saver_enabled() const { |
54 return state_ != THROTTLER_STATE_MARKED_ESSENTIAL; | 58 return state_ != THROTTLER_STATE_MARKED_ESSENTIAL; |
55 } | 59 } |
56 | 60 |
57 void Initialize(RenderFrameImpl* frame, | 61 void Initialize(RenderFrameImpl* frame, |
58 const GURL& content_origin, | 62 const url::Origin& content_origin, |
59 const std::string& plugin_module_name, | 63 const std::string& plugin_module_name, |
60 const gfx::Size& unobscured_size); | 64 const gfx::Size& unobscured_size); |
61 | 65 |
62 // Called when the plugin flushes it's graphics context. Supplies the | 66 // Called when the plugin flushes it's graphics context. Supplies the |
63 // throttler with a candidate to use as the representative keyframe. | 67 // throttler with a candidate to use as the representative keyframe. |
64 void OnImageFlush(const SkBitmap* bitmap); | 68 void OnImageFlush(const SkBitmap* bitmap); |
65 | 69 |
66 // Returns true if |event| was handled and shouldn't be further processed. | 70 // Returns true if |event| was handled and shouldn't be further processed. |
67 bool ConsumeInputEvent(const blink::WebInputEvent& event); | 71 bool ConsumeInputEvent(const blink::WebInputEvent& event); |
68 | 72 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 113 |
110 base::ObserverList<Observer> observer_list_; | 114 base::ObserverList<Observer> observer_list_; |
111 | 115 |
112 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; | 116 base::WeakPtrFactory<PluginInstanceThrottlerImpl> weak_factory_; |
113 | 117 |
114 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); | 118 DISALLOW_COPY_AND_ASSIGN(PluginInstanceThrottlerImpl); |
115 }; | 119 }; |
116 } | 120 } |
117 | 121 |
118 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ | 122 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_INSTANCE_THROTTLER_IMPL_H_ |
OLD | NEW |