Chromium Code Reviews| Index: components/plugins/renderer/loadable_plugin_placeholder.cc |
| diff --git a/components/plugins/renderer/loadable_plugin_placeholder.cc b/components/plugins/renderer/loadable_plugin_placeholder.cc |
| index a47d910835c1910d986355816e16e37979b36602..2ec56a3c2d9c199dc0774393b083f40fb65697b7 100644 |
| --- a/components/plugins/renderer/loadable_plugin_placeholder.cc |
| +++ b/components/plugins/renderer/loadable_plugin_placeholder.cc |
| @@ -270,6 +270,13 @@ void LoadablePluginPlaceholder::DidFinishLoadingCallback() { |
| // This is necessary to prevent a flicker. |
| if (premade_throttler_ && power_saver_enabled_) |
| premade_throttler_->SetHiddenForPlaceholder(true /* hidden */); |
| + |
| + // In case our initial geometry was reported before the placeholder finished |
| + // loading, request another one. Needed for correct large poster unthrottling. |
| + if (plugin()) { |
| + CHECK(plugin()->container()); |
|
tommycli
2015/12/14 21:17:55
The plugin / container semantics are kind-of under
|
| + plugin()->container()->reportGeometry(); |
| + } |
| } |
| void LoadablePluginPlaceholder::DidFinishIconRepositionForTestingCallback() { |
| @@ -347,17 +354,20 @@ void LoadablePluginPlaceholder::RecheckSizeAndMaybeUnthrottle() { |
| // On a size update check if we now qualify as a essential plugin. |
| url::Origin content_origin = url::Origin(GetPluginParams().url); |
| - bool cross_origin_main_content = false; |
| - if (!render_frame()->ShouldThrottleContent( |
| - render_frame()->GetWebFrame()->top()->securityOrigin(), |
| - content_origin, width, height, &cross_origin_main_content)) { |
| + auto status = render_frame()->GetPeripheralContentStatus( |
| + render_frame()->GetWebFrame()->top()->securityOrigin(), content_origin, |
| + gfx::Size(width, height)); |
| + if (status != content::RenderFrame::CONTENT_STATUS_PERIPHERAL) { |
| MarkPluginEssential( |
| heuristic_run_before_ |
| ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE |
| : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); |
| - if (cross_origin_main_content && !heuristic_run_before_) |
| + if (!heuristic_run_before_ && |
| + status == |
| + content::RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) { |
| render_frame()->WhitelistContentOrigin(content_origin); |
| + } |
| } |
| heuristic_run_before_ = true; |