OLD | NEW |
---|---|
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 Loading... | |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
517 // BrowserMainParts ------------------------------------------------------------ | 518 // BrowserMainParts ------------------------------------------------------------ |
518 | 519 |
519 // static | 520 // static |
520 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = | 521 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = |
521 false; | 522 false; |
523 bool ChromeBrowserMainParts::in_force_compositing_mode_trial_ = false; | |
522 | 524 |
523 ChromeBrowserMainParts::ChromeBrowserMainParts( | 525 ChromeBrowserMainParts::ChromeBrowserMainParts( |
524 const content::MainFunctionParams& parameters) | 526 const content::MainFunctionParams& parameters) |
525 : parameters_(parameters), | 527 : parameters_(parameters), |
526 parsed_command_line_(parameters.command_line), | 528 parsed_command_line_(parameters.command_line), |
527 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 529 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
528 startup_watcher_(new StartupTimeBomb()), | 530 startup_watcher_(new StartupTimeBomb()), |
529 shutdown_watcher_(new ShutdownWatcherHelper()), | 531 shutdown_watcher_(new ShutdownWatcherHelper()), |
530 record_search_engine_(false), | 532 record_search_engine_(false), |
531 translate_manager_(NULL), | 533 translate_manager_(NULL), |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 // Create a 100% field trial based on the brand code. | 1006 // Create a 100% field trial based on the brand code. |
1005 if (auto_launch_trial::IsInExperimentGroup(brand)) { | 1007 if (auto_launch_trial::IsInExperimentGroup(brand)) { |
1006 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, | 1008 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, |
1007 kAutoLaunchTrialAutoLaunchGroup); | 1009 kAutoLaunchTrialAutoLaunchGroup); |
1008 } else if (auto_launch_trial::IsInControlGroup(brand)) { | 1010 } else if (auto_launch_trial::IsInControlGroup(brand)) { |
1009 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, | 1011 base::FieldTrialList::CreateFieldTrial(kAutoLaunchTrialName, |
1010 kAutoLaunchTrialControlGroup); | 1012 kAutoLaunchTrialControlGroup); |
1011 } | 1013 } |
1012 } | 1014 } |
1013 | 1015 |
1016 void ChromeBrowserMainParts::ForceCompositingModeFieldTrial() { | |
1017 // Enable the field trial only on the desktop OS's. | |
1018 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) | |
1019 return; | |
1020 #endif | |
1021 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
1022 // Only run the trial on the Canary channel. | |
1023 if (channel != chrome::VersionInfo::CHANNEL_CANARY) | |
1024 return; | |
1025 #if defined(OS_WIN) | |
1026 // 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.
| |
1027 if (base::win::GetVersion() < base::win::VERSION_VISTA) | |
1028 return; | |
1029 #elif defined(OS_MACOSX) | |
1030 // Accelerated compositing is only implemented on Mac OSX 10.6 or later. | |
1031 if (base::mac::IsOSLeopardOrEarlier()) | |
1032 return; | |
1033 #endif | |
1034 | |
1035 const base::FieldTrial::Probability kDivisor = 100; | |
1036 scoped_refptr<base::FieldTrial> trial( | |
1037 base::FieldTrialList::FactoryGetFieldTrial( | |
1038 "ForceCompositingMode", kDivisor, "disable", 2012, 12, 31, NULL)); | |
1039 | |
1040 // Produce the same result on every run of this client. | |
1041 trial->UseOneTimeRandomization(); | |
1042 // 50% probability of being in the enabled group. | |
1043 const base::FieldTrial::Probability kEnableProbability = 50; | |
1044 int enable_group = trial->AppendGroup("enable", kEnableProbability); | |
1045 | |
1046 in_force_compositing_mode_trial_ = (trial->group() == enable_group); | |
1047 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | |
1048 in_force_compositing_mode_trial_); | |
1049 } | |
1050 | |
1014 void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() { | 1051 void ChromeBrowserMainParts::DomainBoundCertsFieldTrial() { |
1015 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1052 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
1016 if (channel == chrome::VersionInfo::CHANNEL_CANARY) { | 1053 if (channel == chrome::VersionInfo::CHANNEL_CANARY) { |
1017 net::SSLConfigService::EnableDomainBoundCertsTrial(); | 1054 net::SSLConfigService::EnableDomainBoundCertsTrial(); |
1018 } else if (channel == chrome::VersionInfo::CHANNEL_DEV && | 1055 } else if (channel == chrome::VersionInfo::CHANNEL_DEV && |
1019 base::FieldTrialList::IsOneTimeRandomizationEnabled()) { | 1056 base::FieldTrialList::IsOneTimeRandomizationEnabled()) { |
1020 const base::FieldTrial::Probability kDivisor = 100; | 1057 const base::FieldTrial::Probability kDivisor = 100; |
1021 // 10% probability of being in the enabled group. | 1058 // 10% probability of being in the enabled group. |
1022 const base::FieldTrial::Probability kEnableProbability = 10; | 1059 const base::FieldTrial::Probability kEnableProbability = 10; |
1023 scoped_refptr<base::FieldTrial> trial = | 1060 scoped_refptr<base::FieldTrial> trial = |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1095 if (!proxy_policy_is_set) | 1132 if (!proxy_policy_is_set) |
1096 ProxyConnectionsFieldTrial(); | 1133 ProxyConnectionsFieldTrial(); |
1097 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 1134 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
1098 SpdyFieldTrial(); | 1135 SpdyFieldTrial(); |
1099 ConnectBackupJobsFieldTrial(); | 1136 ConnectBackupJobsFieldTrial(); |
1100 WarmConnectionFieldTrial(); | 1137 WarmConnectionFieldTrial(); |
1101 PredictorFieldTrial(); | 1138 PredictorFieldTrial(); |
1102 DefaultAppsFieldTrial(); | 1139 DefaultAppsFieldTrial(); |
1103 AutoLaunchChromeFieldTrial(); | 1140 AutoLaunchChromeFieldTrial(); |
1104 DomainBoundCertsFieldTrial(); | 1141 DomainBoundCertsFieldTrial(); |
1142 ForceCompositingModeFieldTrial(); | |
1105 SetupUniformityFieldTrials(); | 1143 SetupUniformityFieldTrials(); |
1106 AutocompleteFieldTrial::Activate(); | 1144 AutocompleteFieldTrial::Activate(); |
1107 } | 1145 } |
1108 | 1146 |
1109 void ChromeBrowserMainParts::StartMetricsRecording() { | 1147 void ChromeBrowserMainParts::StartMetricsRecording() { |
1110 MetricsService* metrics = g_browser_process->metrics_service(); | 1148 MetricsService* metrics = g_browser_process->metrics_service(); |
1111 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) || | 1149 if (parsed_command_line_.HasSwitch(switches::kMetricsRecordingOnly) || |
1112 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) { | 1150 parsed_command_line_.HasSwitch(switches::kEnableBenchmarking)) { |
1113 // If we're testing then we don't care what the user preference is, we turn | 1151 // 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. | 1152 // on recording, but not reporting, otherwise tests fail. |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2005 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2043 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2006 uma_name += "_XP"; | 2044 uma_name += "_XP"; |
2007 | 2045 |
2008 uma_name += "_PreRead_"; | 2046 uma_name += "_PreRead_"; |
2009 uma_name += pre_read_percentage; | 2047 uma_name += pre_read_percentage; |
2010 AddPreReadHistogramTime(uma_name.c_str(), time); | 2048 AddPreReadHistogramTime(uma_name.c_str(), time); |
2011 } | 2049 } |
2012 #endif | 2050 #endif |
2013 #endif | 2051 #endif |
2014 } | 2052 } |
OLD | NEW |