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

Unified Diff: chrome/renderer/plugins/plugin_preroller.cc

Issue 1015023002: Plugin Power Saver: Throttle 'large' plugins that appear small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/plugins/plugin_preroller.cc
diff --git a/chrome/renderer/plugins/plugin_preroller.cc b/chrome/renderer/plugins/plugin_preroller.cc
index a98e77738da7197950fa75940b9b1f579f0c6a98..55754fd29c3f069a6a21717600c5a8acb872ddeb 100644
--- a/chrome/renderer/plugins/plugin_preroller.cc
+++ b/chrome/renderer/plugins/plugin_preroller.cc
@@ -52,16 +52,20 @@ void PluginPreroller::OnKeyframeExtracted(const SkBitmap* bitmap) {
std::string data_url_body;
base::Base64Encode(png_as_string, &data_url_body);
keyframe_data_url_ = GURL(data_url_header + data_url_body);
+ keyframe_size_.SetSize(bitmap->width(), bitmap->height());
}
void PluginPreroller::OnThrottleStateChange() {
if (!throttler_->IsThrottled())
return;
+ keyframe_size_.SetToMin(throttler_->GetSize());
+
ChromePluginPlaceholder* placeholder =
ChromePluginPlaceholder::CreateBlockedPlugin(
render_frame(), frame_, params_, info_, identifier_, name_,
- IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_.spec(), GURL());
+ IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_.spec(), GURL(),
+ keyframe_size_);
placeholder->SetPremadePlugin(throttler_);
placeholder->set_power_saver_enabled(true);
placeholder->set_allow_loading(true);

Powered by Google App Engine
This is Rietveld 408576698