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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1114623002: Plugin Power Saver: Make PPS work well with prerendered pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 #endif // !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS) 843 #endif // !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS)
844 844
845 #if defined(ENABLE_PLUGINS) 845 #if defined(ENABLE_PLUGINS)
846 // Delay loading plugins if prerendering. 846 // Delay loading plugins if prerendering.
847 // TODO(mmenke): In the case of prerendering, feed into 847 // TODO(mmenke): In the case of prerendering, feed into
848 // ChromeContentRendererClient::CreatePlugin instead, to 848 // ChromeContentRendererClient::CreatePlugin instead, to
849 // reduce the chance of future regressions. 849 // reduce the chance of future regressions.
850 bool is_prerendering = 850 bool is_prerendering =
851 prerender::PrerenderHelper::IsPrerendering(render_frame); 851 prerender::PrerenderHelper::IsPrerendering(render_frame);
852 852
853 // TODO(tommycli): Plugin Power Saver is disabled on prerendered pages. 853 // TODO(tommycli): Background tab plugin deferral is disabled.
854 // This is because the placeholder does not feed back into 854 // This is because the placeholder does not feed back into
855 // ChromeContentRendererClient::CreatePlugin. Because of this, it does 855 // ChromeContentRendererClient::CreatePlugin. Because of this, it does
856 // not handle the preroll to UI overlay placeholder flow correctly. 856 // not handle the preroll to UI overlay placeholder flow correctly.
857 //
858 // Background tab plugin deferral is disabled for the same reason.
859 //
860 // https://crbug.com/471427 857 // https://crbug.com/471427
861 bool power_saver_enabled = 858 bool power_saver_enabled =
862 !is_prerendering &&
863 status == 859 status ==
864 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; 860 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
865 861
866 if (info.name == ASCIIToUTF16(content::kFlashPluginName)) 862 if (info.name == ASCIIToUTF16(content::kFlashPluginName))
867 TrackPosterParamPresence(params, power_saver_enabled); 863 TrackPosterParamPresence(params, power_saver_enabled);
868 864
869 PlaceholderPosterInfo poster_info; 865 PlaceholderPosterInfo poster_info;
870 if (power_saver_enabled) { 866 if (power_saver_enabled) {
871 poster_info.poster_attribute = 867 poster_info.poster_attribute =
872 GetPluginInstancePosterAttribute(params); 868 GetPluginInstancePosterAttribute(params);
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 1633
1638 void ChromeContentRendererClient::RecordRappor(const std::string& metric, 1634 void ChromeContentRendererClient::RecordRappor(const std::string& metric,
1639 const std::string& sample) { 1635 const std::string& sample) {
1640 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRappor(metric, sample)); 1636 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRappor(metric, sample));
1641 } 1637 }
1642 1638
1643 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric, 1639 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric,
1644 const GURL& url) { 1640 const GURL& url) {
1645 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRapporURL(metric, url)); 1641 RenderThread::Get()->Send(new ChromeViewHostMsg_RecordRapporURL(metric, url));
1646 } 1642 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698