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 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" | 5 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 RenderFrameImpl* frame, | 128 RenderFrameImpl* frame, |
129 const GURL& content_origin, | 129 const GURL& content_origin, |
130 const std::string& plugin_module_name, | 130 const std::string& plugin_module_name, |
131 const gfx::Size& unobscured_size) { | 131 const gfx::Size& unobscured_size) { |
132 unobscured_size_ = unobscured_size; | 132 unobscured_size_ = unobscured_size; |
133 | 133 |
134 // |frame| may be nullptr in tests. | 134 // |frame| may be nullptr in tests. |
135 if (frame) { | 135 if (frame) { |
136 PluginPowerSaverHelper* helper = frame->plugin_power_saver_helper(); | 136 PluginPowerSaverHelper* helper = frame->plugin_power_saver_helper(); |
137 bool cross_origin_main_content = false; | 137 bool cross_origin_main_content = false; |
| 138 |
138 if (!helper->ShouldThrottleContent(content_origin, plugin_module_name, | 139 if (!helper->ShouldThrottleContent(content_origin, plugin_module_name, |
139 unobscured_size.width(), | 140 unobscured_size.width(), |
140 unobscured_size.height(), | 141 unobscured_size.height(), |
141 &cross_origin_main_content)) { | 142 &cross_origin_main_content)) { |
142 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; | 143 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; |
143 | 144 |
144 if (cross_origin_main_content) | 145 if (cross_origin_main_content) |
145 helper->WhitelistContentOrigin(content_origin); | 146 helper->WhitelistContentOrigin(content_origin); |
146 | 147 |
147 return; | 148 return; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 // Release our reference to the underlying pixel data. | 213 // Release our reference to the underlying pixel data. |
213 last_received_frame_.reset(); | 214 last_received_frame_.reset(); |
214 } | 215 } |
215 | 216 |
216 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; | 217 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; |
217 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); | 218 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); |
218 } | 219 } |
219 | 220 |
220 } // namespace content | 221 } // namespace content |
OLD | NEW |