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

Side by Side Diff: chrome/renderer/plugins/power_saver_info.cc

Issue 2211753002: Plugin Power Saver Tiny: Fix Plugin.PowerSaver.PeripheralHeuristic UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge. and change to enum Created 4 years, 4 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/renderer/plugins/power_saver_info.h" 10 #include "chrome/renderer/plugins/power_saver_info.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 info.power_saver_enabled = override_for_testing == "always" || 95 info.power_saver_enabled = override_for_testing == "always" ||
96 (power_saver_setting_on && is_eligible); 96 (power_saver_setting_on && is_eligible);
97 97
98 if (info.power_saver_enabled) { 98 if (info.power_saver_enabled) {
99 // Even if we disable PPS in the next block because content is same-origin, 99 // Even if we disable PPS in the next block because content is same-origin,
100 // it should still be eligible for background tab deferral if PPS is on. 100 // it should still be eligible for background tab deferral if PPS is on.
101 info.blocked_for_background_tab = render_frame->IsHidden(); 101 info.blocked_for_background_tab = render_frame->IsHidden();
102 102
103 auto status = render_frame->GetPeripheralContentStatus( 103 auto status = render_frame->GetPeripheralContentStatus(
104 render_frame->GetWebFrame()->top()->getSecurityOrigin(), 104 render_frame->GetWebFrame()->top()->getSecurityOrigin(),
105 url::Origin(params.url), gfx::Size()); 105 url::Origin(params.url), gfx::Size(),
106 content::RenderFrame::RECORD_DECISION);
106 107
107 // Early-exit from the whole Power Saver system if the content is 108 // Early-exit from the whole Power Saver system if the content is
108 // same-origin or whitelisted-origin. We ignore the other possibilities, 109 // same-origin or whitelisted-origin. We ignore the other possibilities,
109 // because we don't know the unobscured size of the plugin content yet. 110 // because we don't know the unobscured size of the plugin content yet.
110 // 111 //
111 // Once the plugin is loaded, the peripheral content status is re-tested 112 // Once the plugin is loaded, the peripheral content status is re-tested
112 // with the actual unobscured plugin size. 113 // with the actual unobscured plugin size.
113 if (status == content::RenderFrame::CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN || 114 if (status == content::RenderFrame::CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN ||
114 status == content::RenderFrame:: 115 status == content::RenderFrame::
115 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED) { 116 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED) {
116 info.power_saver_enabled = false; 117 info.power_saver_enabled = false;
117 } else { 118 } else {
118 info.poster_attribute = GetPluginInstancePosterAttribute(params); 119 info.poster_attribute = GetPluginInstancePosterAttribute(params);
119 info.base_url = document_url; 120 info.base_url = document_url;
120 } 121 }
121 } 122 }
122 123
123 if (is_flash) 124 if (is_flash)
124 TrackPosterParamPresence(params, info.power_saver_enabled); 125 TrackPosterParamPresence(params, info.power_saver_enabled);
125 126
126 return info; 127 return info;
127 } 128 }
OLDNEW
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.cc ('k') | components/plugins/renderer/loadable_plugin_placeholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698