Index: chrome/browser/chrome_browser_main.cc |
=================================================================== |
--- chrome/browser/chrome_browser_main.cc (revision 140632) |
+++ chrome/browser/chrome_browser_main.cc (working copy) |
@@ -160,6 +160,7 @@ |
#if defined(OS_MACOSX) |
#include <Security/Security.h> |
+#include "base/mac/mac_util.h" |
#include "base/mac/scoped_nsautorelease_pool.h" |
#include "chrome/browser/mac/keystone_glue.h" |
#endif |
@@ -514,6 +515,10 @@ |
"Unable to find locale data files. Please reinstall."; |
} // namespace chrome_browser |
+namespace chrome_browser_trials { |
+bool g_in_force_compositing_mode_trial = false; |
jar (doing other things)
2012/06/07 16:10:44
Rather than using a global, which then puts a need
|
+} // namespace chrome_browser_trials |
+ |
// BrowserMainParts ------------------------------------------------------------ |
// static |
@@ -1011,6 +1016,42 @@ |
} |
} |
+void ChromeBrowserMainParts::ForceCompositingModeFieldTrial() { |
+// 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 channel. |
+ if (channel != chrome::VersionInfo::CHANNEL_CANARY) |
+ return; |
+#if defined(OS_WIN) |
+ // Don't run the trial on Windows XP. |
+ if (base::win::GetVersion() < base::win::VERSION_VISTA) |
+ return; |
+#elif defined(OS_MACOSX) |
+ // Accelerated compositing is only implemented on Mac OSX 10.6 or later. |
+ if (base::mac::IsOSLeopardOrEarlier()) |
+ return; |
+#endif |
+ |
+ const base::FieldTrial::Probability kDivisor = 100; |
+ scoped_refptr<base::FieldTrial> trial( |
+ base::FieldTrialList::FactoryGetFieldTrial( |
+ "ForceCompositingMode", kDivisor, "disable", 2012, 12, 31, NULL)); |
+ |
+ // Produce the same result on every run of this client. |
+ trial->UseOneTimeRandomization(); |
+ // 50% probability of being in the enabled group. |
+ const base::FieldTrial::Probability kEnableProbability = 50; |
+ int enable_group = trial->AppendGroup("enable", kEnableProbability); |
+ |
+ chrome_browser_trials::g_in_force_compositing_mode_trial = |
+ (trial->group() == enable_group); |
+ UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
+ chrome_browser_trials::g_in_force_compositing_mode_trial); |
+} |
+ |
void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() { |
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
if (channel == chrome::VersionInfo::CHANNEL_CANARY) { |
@@ -1102,6 +1143,7 @@ |
DefaultAppsFieldTrial(); |
AutoLaunchChromeFieldTrial(); |
DomainBoundCertsFieldTrial(); |
+ ForceCompositingModeFieldTrial(); |
jar (doing other things)
2012/06/07 16:10:44
nit: I think you should call this a "CompositingMo
|
SetupUniformityFieldTrials(); |
AutocompleteFieldTrial::Activate(); |
} |