Index: chrome/browser/chrome_content_browser_client.cc |
=================================================================== |
--- chrome/browser/chrome_content_browser_client.cc (revision 140632) |
+++ chrome/browser/chrome_content_browser_client.cc (working copy) |
@@ -10,11 +10,13 @@ |
#include "base/bind.h" |
#include "base/command_line.h" |
+#include "base/metrics/histogram.h" |
#include "base/string_tokenizer.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/app/breakpad_mac.h" |
#include "chrome/browser/browser_about_handler.h" |
#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/browser_trial.h" |
#include "chrome/browser/browsing_data_helper.h" |
#include "chrome/browser/browsing_data_remover.h" |
#include "chrome/browser/character_encoding.h" |
@@ -75,6 +77,7 @@ |
#include "chrome/common/child_process_logging.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/common/chrome_version_info.h" |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/extensions/extension_process_policy.h" |
#include "chrome/common/extensions/extension_set.h" |
@@ -104,8 +107,10 @@ |
#include "webkit/plugins/plugin_switches.h" |
#if defined(OS_WIN) |
+#include "base/win/windows_version.h" |
#include "chrome/browser/chrome_browser_main_win.h" |
#elif defined(OS_MACOSX) |
+#include "base/mac/mac_util.h" |
#include "chrome/browser/chrome_browser_main_mac.h" |
#include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" |
#elif defined(OS_CHROMEOS) |
@@ -307,6 +312,43 @@ |
} |
} |
+void CheckForceCompositingModeTrialFlag(CommandLine* command_line) { |
+ 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 |
+ |
+ static base::FieldTrial* trial = NULL; |
+ static bool in_enable_group = false; |
+ |
+ if (!trial) { |
+ const base::FieldTrial::Probability kDivisor = 100; |
+ // 50% probability of being in the enabled group. |
+ const base::FieldTrial::Probability kEnableProbability = 50; |
+ trial = base::FieldTrialList::FactoryGetFieldTrial( |
+ BrowserTrial::kForceCompositingModeTrial, kDivisor, |
+ "disable", 2012, 12, 31, NULL); |
+ // Produce the same result on every run of this client. |
+ trial->UseOneTimeRandomization(); |
+ int enable_group = trial->AppendGroup("enable", kEnableProbability); |
+ in_enable_group = (trial->group() == enable_group); |
+ UMA_HISTOGRAM_ENUMERATION("GPU.InForceCompositingModeFieldTrial", |
Ilya Sherman
2012/06/06 09:50:21
nit: UMA_HISTOGRAM_BOOLEAN?
|
+ in_enable_group ? 1 : 0, 2); |
+ } |
+ |
+ if (in_enable_group) |
+ command_line->AppendSwitch(switches::kForceCompositingMode); |
+} |
+ |
} // namespace |
namespace chrome { |
@@ -751,6 +793,8 @@ |
} |
} |
+ CheckForceCompositingModeTrialFlag(command_line); |
+ |
// Please keep this in alphabetical order. |
static const char* const kSwitchNames[] = { |
switches::kAllowHTTPBackgroundPage, |