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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 10541019: Adding a field trial for testing --force-compositing-mode on 50% of (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698