Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: components/plugins/renderer/loadable_plugin_placeholder.cc

Issue 2765633002: Plugin Power Saver Tiny: Treat completely obscured plugins as Tiny. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_ && status == RenderFrame::CONTENT_STATUS_TINY; 212 is_blocked_for_tinyness_ && status == RenderFrame::CONTENT_STATUS_TINY;
213 213
214 // Early exit for plugins that we've discovered to be essential. 214 // Early exit for plugins that we've discovered to be essential.
215 if (!plugin_is_tiny_and_blocked && 215 if (!plugin_is_tiny_and_blocked &&
216 status != RenderFrame::CONTENT_STATUS_PERIPHERAL) { 216 status != RenderFrame::CONTENT_STATUS_PERIPHERAL &&
217 status != RenderFrame::CONTENT_STATUS_TINY) {
217 MarkPluginEssential( 218 MarkPluginEssential(
218 heuristic_run_before_ 219 heuristic_run_before_
219 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE 220 ? PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_SIZE_CHANGE
220 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD); 221 : PluginInstanceThrottler::UNTHROTTLE_METHOD_DO_NOT_RECORD);
221 222
222 if (!heuristic_run_before_ && 223 if (!heuristic_run_before_ &&
223 status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) { 224 status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG) {
224 render_frame()->WhitelistContentOrigin(content_origin); 225 render_frame()->WhitelistContentOrigin(content_origin);
225 } 226 }
226 227
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return identifier_; 367 return identifier_;
367 } 368 }
368 369
369 bool LoadablePluginPlaceholder::LoadingBlocked() const { 370 bool LoadablePluginPlaceholder::LoadingBlocked() const {
370 DCHECK(allow_loading_); 371 DCHECK(allow_loading_);
371 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ || 372 return is_blocked_for_tinyness_ || is_blocked_for_background_tab_ ||
372 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_; 373 is_blocked_for_power_saver_poster_ || is_blocked_for_prerendering_;
373 } 374 }
374 375
375 } // namespace plugins 376 } // namespace plugins
OLDNEW
« no previous file with comments | « chrome/test/data/plugin_power_saver/block_tiny_plugins.html ('k') | content/public/renderer/render_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698