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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #include "chrome/installer/util/install_util.h" 153 #include "chrome/installer/util/install_util.h"
154 #include "chrome/installer/util/shell_util.h" 154 #include "chrome/installer/util/shell_util.h"
155 #include "net/base/net_util.h" 155 #include "net/base/net_util.h"
156 #include "printing/printed_document.h" 156 #include "printing/printed_document.h"
157 #include "ui/base/l10n/l10n_util_win.h" 157 #include "ui/base/l10n/l10n_util_win.h"
158 #endif // defined(OS_WIN) 158 #endif // defined(OS_WIN)
159 159
160 #if defined(OS_MACOSX) 160 #if defined(OS_MACOSX)
161 #include <Security/Security.h> 161 #include <Security/Security.h>
162 162
163 #include "base/mac/mac_util.h"
163 #include "base/mac/scoped_nsautorelease_pool.h" 164 #include "base/mac/scoped_nsautorelease_pool.h"
164 #include "chrome/browser/mac/keystone_glue.h" 165 #include "chrome/browser/mac/keystone_glue.h"
165 #endif 166 #endif
166 167
167 #if defined(ENABLE_RLZ) 168 #if defined(ENABLE_RLZ)
168 #include "chrome/browser/rlz/rlz.h" 169 #include "chrome/browser/rlz/rlz.h"
169 #endif 170 #endif
170 171
171 #if defined(TOOLKIT_VIEWS) 172 #if defined(TOOLKIT_VIEWS)
172 #include "ui/views/focus/accelerator_handler.h" 173 #include "ui/views/focus/accelerator_handler.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } // namespace 508 } // namespace
508 509
509 namespace chrome_browser { 510 namespace chrome_browser {
510 // This error message is not localized because we failed to load the 511 // This error message is not localized because we failed to load the
511 // localization data files. 512 // localization data files.
512 const char kMissingLocaleDataTitle[] = "Missing File Error"; 513 const char kMissingLocaleDataTitle[] = "Missing File Error";
513 const char kMissingLocaleDataMessage[] = 514 const char kMissingLocaleDataMessage[] =
514 "Unable to find locale data files. Please reinstall."; 515 "Unable to find locale data files. Please reinstall.";
515 } // namespace chrome_browser 516 } // namespace chrome_browser
516 517
518 namespace chrome_browser_trials {
519 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
520 } // namespace chrome_browser_trials
521
517 // BrowserMainParts ------------------------------------------------------------ 522 // BrowserMainParts ------------------------------------------------------------
518 523
519 // static 524 // static
520 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = 525 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ =
521 false; 526 false;
522 527
523 ChromeBrowserMainParts::ChromeBrowserMainParts( 528 ChromeBrowserMainParts::ChromeBrowserMainParts(
524 const content::MainFunctionParams& parameters) 529 const content::MainFunctionParams& parameters)
525 : parameters_(parameters), 530 : parameters_(parameters),
526 parsed_command_line_(parameters.command_line), 531 parsed_command_line_(parameters.command_line),
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 // Create a 100% field trial based on the brand code. 1009 // Create a 100% field trial based on the brand code.
1005 if (auto_launch_trial::IsInExperimentGroup(brand)) { 1010 if (auto_launch_trial::IsInExperimentGroup(brand)) {
1006 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, 1011 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
1007 kAutoLaunchTrialAutoLaunchGroup); 1012 kAutoLaunchTrialAutoLaunchGroup);
1008 } else if (auto_launch_trial::IsInControlGroup(brand)) { 1013 } else if (auto_launch_trial::IsInControlGroup(brand)) {
1009 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, 1014 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName,
1010 kAutoLaunchTrialControlGroup); 1015 kAutoLaunchTrialControlGroup);
1011 } 1016 }
1012 } 1017 }
1013 1018
1019 void ChromeBrowserMainParts::ForceCompositingModeFieldTrial() {
1020 // Enable the field trial only on desktop OS's.
1021 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
1022 return;
1023 #endif
1024 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1025 // Only run the trial on the Canary channel.
1026 if (channel != chrome::VersionInfo::CHANNEL_CANARY)
1027 return;
1028 #if defined(OS_WIN)
1029 // Don't run the trial on Windows XP.
1030 if (base::win::GetVersion() < base::win::VERSION_VISTA)
1031 return;
1032 #elif defined(OS_MACOSX)
1033 // Accelerated compositing is only implemented on Mac OSX 10.6 or later.
1034 if (base::mac::IsOSLeopardOrEarlier())
1035 return;
1036 #endif
1037
1038 const base::FieldTrial::Probability kDivisor = 100;
1039 scoped_refptr<base::FieldTrial> trial(
1040 base::FieldTrialList::FactoryGetFieldTrial(
1041 "ForceCompositingMode", kDivisor, "disable", 2012, 12, 31, NULL));
1042
1043 // Produce the same result on every run of this client.
1044 trial->UseOneTimeRandomization();
1045 // 50% probability of being in the enabled group.
1046 const base::FieldTrial::Probability kEnableProbability = 50;
1047 int enable_group = trial->AppendGroup("enable", kEnableProbability);
1048
1049 chrome_browser_trials::g_in_force_compositing_mode_trial =
1050 (trial->group() == enable_group);
1051 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial",
1052 chrome_browser_trials::g_in_force_compositing_mode_trial);
1053 }
1054
1014 void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() { 1055 void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() {
1015 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 1056 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
1016 if (channel == chrome::VersionInfo::CHANNEL_CANARY) { 1057 if (channel == chrome::VersionInfo::CHANNEL_CANARY) {
1017 net::SSLConfigService::EnableDomainBoundCertsTrial(); 1058 net::SSLConfigService::EnableDomainBoundCertsTrial();
1018 } else if (channel == chrome::VersionInfo::CHANNEL_DEV && 1059 } else if (channel == chrome::VersionInfo::CHANNEL_DEV &&
1019 base::FieldTrialList::IsOneTimeRandomizationEnabled()) { 1060 base::FieldTrialList::IsOneTimeRandomizationEnabled()) {
1020 const base::FieldTrial::Probability kDivisor = 100; 1061 const base::FieldTrial::Probability kDivisor = 100;
1021 // 10% probability of being in the enabled group. 1062 // 10% probability of being in the enabled group.
1022 const base::FieldTrial::Probability kEnableProbability = 10; 1063 const base::FieldTrial::Probability kEnableProbability = 10;
1023 scoped_refptr<base::FieldTrial> trial = 1064 scoped_refptr<base::FieldTrial> trial =
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 if (!proxy_policy_is_set) 1136 if (!proxy_policy_is_set)
1096 ProxyConnectionsFieldTrial(); 1137 ProxyConnectionsFieldTrial();
1097 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); 1138 prerender::ConfigurePrefetchAndPrerender(parsed_command_line());
1098 SpdyFieldTrial(); 1139 SpdyFieldTrial();
1099 ConnectBackupJobsFieldTrial(); 1140 ConnectBackupJobsFieldTrial();
1100 WarmConnectionFieldTrial(); 1141 WarmConnectionFieldTrial();
1101 PredictorFieldTrial(); 1142 PredictorFieldTrial();
1102 DefaultAppsFieldTrial(); 1143 DefaultAppsFieldTrial();
1103 AutoLaunchChromeFieldTrial(); 1144 AutoLaunchChromeFieldTrial();
1104 DomainBoundCertsFieldTrial(); 1145 DomainBoundCertsFieldTrial();
1146 ForceCompositingModeFieldTrial();
jar (doing other things) 2012/06/07 16:10:44 nit: I think you should call this a "CompositingMo
1105 SetupUniformityFieldTrials(); 1147 SetupUniformityFieldTrials();
1106 AutocompleteFieldTrial::Activate(); 1148 AutocompleteFieldTrial::Activate();
1107 } 1149 }
1108 1150
1109 void ChromeBrowserMainParts::StartMetricsRecording() { 1151 void ChromeBrowserMainParts::StartMetricsRecording() {
1110 MetricsService* metrics = g_browser_process->metrics_service(); 1152 MetricsService* metrics = g_browser_process->metrics_service();
1111 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) || 1153 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) ||
1112 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) { 1154 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) {
1113 // If we're testing then we don't care what the user preference is, we turn 1155 // If we're testing then we don't care what the user preference is, we turn
1114 // on recording, but not reporting, otherwise tests fail. 1156 // on recording, but not reporting, otherwise tests fail.
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 if (base::win::GetVersion() <= base::win::VERSION_XP) 2047 if (base::win::GetVersion() <= base::win::VERSION_XP)
2006 uma_name += "_XP"; 2048 uma_name += "_XP";
2007 2049
2008 uma_name += "_PreRead_"; 2050 uma_name += "_PreRead_";
2009 uma_name += pre_read_percentage; 2051 uma_name += pre_read_percentage;
2010 AddPreReadHistogramTime(uma_name.c_str(), time); 2052 AddPreReadHistogramTime(uma_name.c_str(), time);
2011 } 2053 }
2012 #endif 2054 #endif
2013 #endif 2055 #endif
2014 } 2056 }
OLDNEW
« 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