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 |
@@ -519,6 +520,7 @@ |
// static |
bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = |
false; |
+bool ChromeBrowserMainParts::in_force_compositing_mode_trial_ = false; |
ChromeBrowserMainParts::ChromeBrowserMainParts( |
const content::MainFunctionParams& parameters) |
@@ -1011,6 +1013,41 @@ |
} |
} |
+void ChromeBrowserMainParts::ForceCompositingModeFieldTrial() { |
+// Enable the field trial only on the 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. |
Ilya Sherman
2012/06/06 22:31:51
nit: "windows" -> "Windows"
vangelis
2012/06/06 23:44:44
Done.
|
+ 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); |
+ |
+ in_force_compositing_mode_trial_ = (trial->group() == enable_group); |
+ UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
+ in_force_compositing_mode_trial_); |
+} |
+ |
void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() { |
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
if (channel == chrome::VersionInfo::CHANNEL_CANARY) { |
@@ -1102,6 +1139,7 @@ |
DefaultAppsFieldTrial(); |
AutoLaunchChromeFieldTrial(); |
DomainBoundCertsFieldTrial(); |
+ ForceCompositingModeFieldTrial(); |
SetupUniformityFieldTrials(); |
AutocompleteFieldTrial::Activate(); |
} |