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

Unified Diff: chrome/browser/gpu_util.cc

Issue 10824168: Cleaning up compositing field trial code and enable FCM in beta/stable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: revert some.gyp Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/gpu_util.cc
diff --git a/chrome/browser/gpu_util.cc b/chrome/browser/gpu_util.cc
index 8e88899499376342f7b562709e730aef614b6082..3295d447ac15a05848ad0560765e7a38f5b8f3bd 100644
--- a/chrome/browser/gpu_util.cc
+++ b/chrome/browser/gpu_util.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/common/chrome_version_info.h"
#include "content/public/browser/gpu_data_manager.h"
+#include "content/public/common/compositor_util.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/gpu_info.h"
@@ -168,27 +169,15 @@ int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) {
}
#endif // OS_WIN
-bool InForceThreadedCompositingModeTrial() {
- base::FieldTrial* trial =
- base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
- return trial && trial->group_name() ==
- content::kGpuCompositingFieldTrialThreadEnabledName;
-}
-
} // namespace
namespace gpu_util {
-void InitializeForceCompositingModeFieldTrial() {
+void InitializeCompositingFieldTrial() {
// Enable the field trial only on desktop OS's.
#if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
return;
#endif
- chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
- // Only run the trial on the Canary and Dev channels.
- if (channel != chrome::VersionInfo::CHANNEL_CANARY &&
- channel != chrome::VersionInfo::CHANNEL_DEV)
- return;
#if defined(OS_WIN)
// Don't run the trial on Windows XP.
if (base::win::GetVersion() < base::win::VERSION_VISTA)
@@ -207,9 +196,7 @@ void InitializeForceCompositingModeFieldTrial() {
// Don't activate the field trial if force-compositing-mode has been
// explicitly disabled from the command line.
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableForceCompositingMode) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableThreadedCompositing))
+ switches::kDisableForceCompositingMode))
return;
const base::FieldTrial::Probability kDivisor = 3;
@@ -220,29 +207,43 @@ void InitializeForceCompositingModeFieldTrial() {
// Produce the same result on every run of this client.
trial->UseOneTimeRandomization();
- // 1/3 probability of being in the enabled or thread group.
- const base::FieldTrial::Probability kEnableProbability = 1;
- int enable_group = trial->AppendGroup(
- content::kGpuCompositingFieldTrialEnabledName, kEnableProbability);
+
+ base::FieldTrial::Probability forceCompositingModeProbability = 0;
darin (slow to review) 2012/08/06 20:39:38 nit: google_style_variables
+ base::FieldTrial::Probability threadedCompositingProbability = 0;
+
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
+ channel == chrome::VersionInfo::CHANNEL_BETA) {
+ // Stable and Beta channels: Non-threaded force-compositing-mode on by
+ // default (mac and windows only).
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ forceCompositingModeProbability = 3;
+#endif
+ } else if (channel == chrome::VersionInfo::CHANNEL_DEV ||
+ channel == chrome::VersionInfo::CHANNEL_CANARY) {
+ // Dev and Canary channels: force-compositing-mode and
+ // threaded-compositing on with 1/3 probability each.
+ forceCompositingModeProbability = 1;
+
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableThreadedCompositing))
+ threadedCompositingProbability = 1;
+ }
+
+ int force_compositing_group = trial->AppendGroup(
+ content::kGpuCompositingFieldTrialForceCompositingEnabledName,
+ forceCompositingModeProbability);
int thread_group = trial->AppendGroup(
- content::kGpuCompositingFieldTrialThreadEnabledName, kEnableProbability);
+ content::kGpuCompositingFieldTrialThreadEnabledName,
+ threadedCompositingProbability);
- bool enabled = (trial->group() == enable_group);
+ bool force_compositing = (trial->group() == force_compositing_group);
bool thread = (trial->group() == thread_group);
- UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", enabled);
+ UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial",
+ force_compositing);
UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread);
}
-bool InForceCompositingModeOrThreadTrial() {
- base::FieldTrial* trial =
- base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
- if (!trial)
- return false;
- return trial->group_name() == content::kGpuCompositingFieldTrialEnabledName ||
- trial->group_name() ==
- content::kGpuCompositingFieldTrialThreadEnabledName;
-}
-
GpuFeatureType StringToGpuFeatureType(const std::string& feature_string) {
if (feature_string == kGpuFeatureNameAccelerated2dCanvas)
return content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS;
@@ -406,16 +407,10 @@ Value* GetFeatureStatus() {
(command_line.HasSwitch(switches::kDisableAcceleratedCompositing) ||
(flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)))
status += "_readback";
- bool has_thread =
- (command_line.HasSwitch(switches::kEnableThreadedCompositing) &&
- !command_line.HasSwitch(switches::kDisableThreadedCompositing)) ||
- InForceThreadedCompositingModeTrial();
+ bool has_thread = compositor_util::IsThreadedCompositingEnabled();
if (kGpuFeatureInfo[i].name == "compositing") {
bool force_compositing =
- (command_line.HasSwitch(switches::kForceCompositingMode) &&
- !command_line.HasSwitch(
- switches::kDisableForceCompositingMode)) ||
- InForceCompositingModeOrThreadTrial();
+ compositor_util::IsForceCompositingModeEnabled();
if (force_compositing)
status += "_force";
if (has_thread)

Powered by Google App Engine
This is Rietveld 408576698