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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const url::Origin& content_origin, | 134 const url::Origin& content_origin, |
135 const std::string& plugin_module_name, | 135 const std::string& plugin_module_name, |
136 const gfx::Size& unobscured_size) { | 136 const gfx::Size& unobscured_size) { |
137 DCHECK(unobscured_size_.IsEmpty()); | 137 DCHECK(unobscured_size_.IsEmpty()); |
138 unobscured_size_ = unobscured_size; | 138 unobscured_size_ = unobscured_size; |
139 | 139 |
140 // |frame| may be nullptr in tests. | 140 // |frame| may be nullptr in tests. |
141 if (frame) { | 141 if (frame) { |
142 float zoom_factor = GetWebPlugin()->container()->pageZoomFactor(); | 142 float zoom_factor = GetWebPlugin()->container()->pageZoomFactor(); |
143 auto status = frame->GetPeripheralContentStatus( | 143 auto status = frame->GetPeripheralContentStatus( |
144 frame->GetWebFrame()->top()->securityOrigin(), content_origin, | 144 frame->GetWebFrame()->top()->getSecurityOrigin(), content_origin, |
145 gfx::Size(roundf(unobscured_size.width() / zoom_factor), | 145 gfx::Size(roundf(unobscured_size.width() / zoom_factor), |
146 roundf(unobscured_size.height() / zoom_factor))); | 146 roundf(unobscured_size.height() / zoom_factor))); |
147 if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { | 147 if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { |
148 DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_); | 148 DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_); |
149 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; | 149 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; |
150 FOR_EACH_OBSERVER(Observer, observer_list_, OnPeripheralStateChange()); | 150 FOR_EACH_OBSERVER(Observer, observer_list_, OnPeripheralStateChange()); |
151 | 151 |
152 if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) | 152 if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) |
153 frame->WhitelistContentOrigin(content_origin); | 153 frame->WhitelistContentOrigin(content_origin); |
154 | 154 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 // Release our reference to the underlying pixel data. | 215 // Release our reference to the underlying pixel data. |
216 last_received_frame_.reset(); | 216 last_received_frame_.reset(); |
217 } | 217 } |
218 | 218 |
219 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; | 219 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; |
220 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); | 220 FOR_EACH_OBSERVER(Observer, observer_list_, OnThrottleStateChange()); |
221 } | 221 } |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
OLD | NEW |