OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/plugins/renderer/loadable_plugin_placeholder.h" | 5 #include "components/plugins/renderer/loadable_plugin_placeholder.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // On a size update check if we now qualify as a essential plugin. | 202 // On a size update check if we now qualify as a essential plugin. |
203 url::Origin content_origin = url::Origin(GetPluginParams().url); | 203 url::Origin content_origin = url::Origin(GetPluginParams().url); |
204 RenderFrame::PeripheralContentStatus status = | 204 RenderFrame::PeripheralContentStatus status = |
205 render_frame()->GetPeripheralContentStatus( | 205 render_frame()->GetPeripheralContentStatus( |
206 render_frame()->GetWebFrame()->top()->getSecurityOrigin(), | 206 render_frame()->GetWebFrame()->top()->getSecurityOrigin(), |
207 content_origin, gfx::Size(width, height), | 207 content_origin, gfx::Size(width, height), |
208 heuristic_run_before_ ? RenderFrame::DONT_RECORD_DECISION | 208 heuristic_run_before_ ? RenderFrame::DONT_RECORD_DECISION |
209 : RenderFrame::RECORD_DECISION); | 209 : RenderFrame::RECORD_DECISION); |
210 | 210 |
211 bool plugin_is_tiny_and_blocked = | 211 bool plugin_is_tiny_and_blocked = |
212 is_blocked_for_tinyness_ && | 212 is_blocked_for_tinyness_ && status == RenderFrame::CONTENT_STATUS_TINY; |
213 status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY; | |
214 | 213 |
215 // Early exit for plugins that we've discovered to be essential. | 214 // Early exit for plugins that we've discovered to be essential. |
216 if (!plugin_is_tiny_and_blocked && | 215 if (!plugin_is_tiny_and_blocked && |
217 status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { | 216 status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { |
218 MarkPluginEssential( | 217 MarkPluginEssential( |
219 heuristic_run_before_ | 218 heuristic_run_before_ |
220 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE | 219 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE |
221 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); | 220 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); |
222 | 221 |
223 if (!heuristic_run_before_ && | 222 if (!heuristic_run_before_ && |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 return identifier_; | 364 return identifier_; |
366 } | 365 } |
367 | 366 |
368 bool LoadablePluginPlaceholder::LoadingBlocked() const { | 367 bool LoadablePluginPlaceholder::LoadingBlocked() const { |
369 DCHECK(allow_loading_); | 368 DCHECK(allow_loading_); |
370 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || | 369 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || |
371 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; | 370 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; |
372 } | 371 } |
373 | 372 |
374 } // namespace plugins | 373 } // namespace plugins |
OLD | NEW |