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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 unobscured_size_ = unobscured_size; | 146 unobscured_size_ = unobscured_size; |
147 | 147 |
148 // |frame| may be nullptr in tests. | 148 // |frame| may be nullptr in tests. |
149 if (frame) { | 149 if (frame) { |
150 float zoom_factor = GetWebPlugin()->container()->pageZoomFactor(); | 150 float zoom_factor = GetWebPlugin()->container()->pageZoomFactor(); |
151 auto status = frame->GetPeripheralContentStatus( | 151 auto status = frame->GetPeripheralContentStatus( |
152 frame->GetWebFrame()->top()->getSecurityOrigin(), content_origin, | 152 frame->GetWebFrame()->top()->getSecurityOrigin(), content_origin, |
153 gfx::Size(roundf(unobscured_size.width() / zoom_factor), | 153 gfx::Size(roundf(unobscured_size.width() / zoom_factor), |
154 roundf(unobscured_size.height() / zoom_factor)), | 154 roundf(unobscured_size.height() / zoom_factor)), |
155 record_decision_); | 155 record_decision_); |
156 if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { | 156 if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL && |
| 157 status != RenderFrame::CONTENT_STATUS_TINY) { |
157 DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_); | 158 DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_); |
158 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; | 159 state_ = THROTTLER_STATE_MARKED_ESSENTIAL; |
159 for (auto& observer : observer_list_) | 160 for (auto& observer : observer_list_) |
160 observer.OnPeripheralStateChange(); | 161 observer.OnPeripheralStateChange(); |
161 | 162 |
162 if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) | 163 if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) |
163 frame->WhitelistContentOrigin(content_origin); | 164 frame->WhitelistContentOrigin(content_origin); |
164 | 165 |
165 return; | 166 return; |
166 } | 167 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Release our reference to the underlying pixel data. | 226 // Release our reference to the underlying pixel data. |
226 last_received_frame_.reset(); | 227 last_received_frame_.reset(); |
227 } | 228 } |
228 | 229 |
229 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; | 230 state_ = THROTTLER_STATE_PLUGIN_THROTTLED; |
230 for (auto& observer : observer_list_) | 231 for (auto& observer : observer_list_) |
231 observer.OnThrottleStateChange(); | 232 observer.OnThrottleStateChange(); |
232 } | 233 } |
233 | 234 |
234 } // namespace content | 235 } // namespace content |
OLD | NEW |