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

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl.cc

Issue 1522173002: Reland: Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix an NPE crash/race on plugin destruction Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/plugin_instance_throttler_impl.cc
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl.cc b/content/renderer/pepper/plugin_instance_throttler_impl.cc
index 22bfec87c01a169bd070ab9f36feb7e1246c2572..5a153b79b095503b2c05873c489bcaad1a5fcc3d 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl.cc
@@ -139,18 +139,17 @@ void PluginInstanceThrottlerImpl::Initialize(
// |frame| may be nullptr in tests.
if (frame) {
- bool cross_origin_main_content = false;
float zoom_factor = GetWebPlugin()->container()->pageZoomFactor();
- if (!frame->ShouldThrottleContent(
- frame->GetWebFrame()->top()->securityOrigin(), content_origin,
- roundf(unobscured_size.width() / zoom_factor),
- roundf(unobscured_size.height() / zoom_factor),
- &cross_origin_main_content)) {
+ auto status = frame->GetPeripheralContentStatus(
+ frame->GetWebFrame()->top()->securityOrigin(), content_origin,
+ gfx::Size(roundf(unobscured_size.width() / zoom_factor),
+ roundf(unobscured_size.height() / zoom_factor)));
+ if (status != RenderFrame::CONTENT_STATUS_PERIPHERAL) {
DCHECK_NE(THROTTLER_STATE_MARKED_ESSENTIAL, state_);
state_ = THROTTLER_STATE_MARKED_ESSENTIAL;
FOR_EACH_OBSERVER(Observer, observer_list_, OnPeripheralStateChange());
- if (cross_origin_main_content)
+ if (status == RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG)
frame->WhitelistContentOrigin(content_origin);
return;

Powered by Google App Engine
This is Rietveld 408576698