Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_main.h" | 5 #include "chrome/browser/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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 194 |
| 195 if (parsed_command_line().HasSwitch(switches::kEnableBenchmarking)) | 195 if (parsed_command_line().HasSwitch(switches::kEnableBenchmarking)) |
| 196 base::FieldTrial::EnableBenchmarking(); | 196 base::FieldTrial::EnableBenchmarking(); |
| 197 | 197 |
| 198 // Note: make sure to call ConnectionFieldTrial() before | 198 // Note: make sure to call ConnectionFieldTrial() before |
| 199 // ProxyConnectionsFieldTrial(). | 199 // ProxyConnectionsFieldTrial(). |
| 200 ConnectionFieldTrial(); | 200 ConnectionFieldTrial(); |
| 201 SocketTimeoutFieldTrial(); | 201 SocketTimeoutFieldTrial(); |
| 202 ProxyConnectionsFieldTrial(); | 202 ProxyConnectionsFieldTrial(); |
| 203 SpdyFieldTrial(); | 203 SpdyFieldTrial(); |
| 204 PrefetchFieldTrial(); | |
| 205 ConnectBackupJobsFieldTrial(); | 204 ConnectBackupJobsFieldTrial(); |
| 206 InitializeSSL(); | 205 InitializeSSL(); |
| 207 | 206 |
| 208 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts)) | 207 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts)) |
| 209 net::SSLConfigService::EnableDNSSEC(); | 208 net::SSLConfigService::EnableDNSSEC(); |
| 210 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart)) | 209 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart)) |
| 211 net::SSLConfigService::DisableFalseStart(); | 210 net::SSLConfigService::DisableFalseStart(); |
| 212 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies)) | 211 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies)) |
| 213 net::SSLConfigService::AllowMITMProxies(); | 212 net::SSLConfigService::AllowMITMProxies(); |
| 214 // Disabled to stop people playing with it. | 213 // Disabled to stop people playing with it. |
| 215 // if (parsed_command_line().HasSwitch(switches::kEnableSnapStart)) | 214 // if (parsed_command_line().HasSwitch(switches::kEnableSnapStart)) |
| 216 // net::SSLConfigService::EnableSnapStart(); | 215 // net::SSLConfigService::EnableSnapStart(); |
| 217 if (parsed_command_line().HasSwitch( | 216 if (parsed_command_line().HasSwitch( |
| 218 switches::kEnableDNSCertProvenanceChecking)) { | 217 switches::kEnableDNSCertProvenanceChecking)) { |
| 219 net::SSLConfigService::EnableDNSCertProvenanceChecking(); | 218 net::SSLConfigService::EnableDNSCertProvenanceChecking(); |
| 220 } | 219 } |
| 221 | 220 |
| 222 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen)) | 221 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen)) |
| 223 net::set_tcp_fastopen_enabled(true); | 222 net::set_tcp_fastopen_enabled(true); |
| 224 | 223 |
| 225 PostEarlyInitialization(); | 224 PostEarlyInitialization(); |
| 226 } | 225 } |
| 227 | 226 |
| 227 // This will be called after the command-line has been mutated by about:flags | |
| 228 void BrowserMainParts::PostAboutFlagsConvertedToSwitches() { | |
| 229 PrefetchFieldTrial(); | |
| 230 } | |
| 231 | |
| 228 // This is an A/B test for the maximum number of persistent connections per | 232 // This is an A/B test for the maximum number of persistent connections per |
| 229 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 233 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
| 230 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 234 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
| 231 // run faster) uses 8. We would like to see how much of an effect this value has | 235 // run faster) uses 8. We would like to see how much of an effect this value has |
| 232 // on browsing. Too large a value might cause us to run into SYN flood detection | 236 // on browsing. Too large a value might cause us to run into SYN flood detection |
| 233 // mechanisms. | 237 // mechanisms. |
| 234 void BrowserMainParts::ConnectionFieldTrial() { | 238 void BrowserMainParts::ConnectionFieldTrial() { |
| 235 const base::FieldTrial::Probability kConnectDivisor = 100; | 239 const base::FieldTrial::Probability kConnectDivisor = 100; |
| 236 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | 240 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. |
| 237 | 241 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 // Now that all preferences have been registered, set the install date | 1258 // Now that all preferences have been registered, set the install date |
| 1255 // for the uninstall metrics if this is our first run. This only actually | 1259 // for the uninstall metrics if this is our first run. This only actually |
| 1256 // gets used if the user has metrics reporting enabled at uninstall time. | 1260 // gets used if the user has metrics reporting enabled at uninstall time. |
| 1257 int64 install_date = | 1261 int64 install_date = |
| 1258 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); | 1262 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); |
| 1259 if (install_date == 0) { | 1263 if (install_date == 0) { |
| 1260 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, | 1264 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, |
| 1261 base::Time::Now().ToTimeT()); | 1265 base::Time::Now().ToTimeT()); |
| 1262 } | 1266 } |
| 1263 | 1267 |
| 1268 // Now the command line has been mutated based on about:flags, we can run some | |
| 1269 // field tests | |
| 1270 parts->PostAboutFlagsConvertedToSwitches(); | |
|
cbentzel
2011/01/25 21:50:21
This should be done directly after ConvertFlagsToS
dominich
2011/01/25 22:00:45
Done.
| |
| 1271 | |
| 1264 #if defined(OS_MACOSX) | 1272 #if defined(OS_MACOSX) |
| 1265 // Get the Keychain API to register for distributed notifications on the main | 1273 // Get the Keychain API to register for distributed notifications on the main |
| 1266 // thread, which has a proper CFRunloop, instead of later on the I/O thread, | 1274 // thread, which has a proper CFRunloop, instead of later on the I/O thread, |
| 1267 // which doesn't. This ensures those notifications will get delivered | 1275 // which doesn't. This ensures those notifications will get delivered |
| 1268 // properly. See issue 37766. | 1276 // properly. See issue 37766. |
| 1269 // (Note that the callback mask here is empty. I don't want to register for | 1277 // (Note that the callback mask here is empty. I don't want to register for |
| 1270 // any callbacks, I just want to initialize the mechanism.) | 1278 // any callbacks, I just want to initialize the mechanism.) |
| 1271 SecKeychainAddCallback(&KeychainCallback, 0, NULL); | 1279 SecKeychainAddCallback(&KeychainCallback, 0, NULL); |
| 1272 #endif | 1280 #endif |
| 1273 | 1281 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 std::string username = | 1399 std::string username = |
| 1392 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); | 1400 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 1393 VLOG(1) << "Relaunching browser for user: " << username; | 1401 VLOG(1) << "Relaunching browser for user: " << username; |
| 1394 chromeos::UserManager::Get()->UserLoggedIn(username); | 1402 chromeos::UserManager::Get()->UserLoggedIn(username); |
| 1395 | 1403 |
| 1396 // Redirects Chrome logging to the user data dir. | 1404 // Redirects Chrome logging to the user data dir. |
| 1397 logging::RedirectChromeLogging(parsed_command_line); | 1405 logging::RedirectChromeLogging(parsed_command_line); |
| 1398 } | 1406 } |
| 1399 #endif | 1407 #endif |
| 1400 | 1408 |
| 1401 // Modifies the current command line based on active experiments on | |
| 1402 // about:flags. | |
| 1403 Profile* profile = CreateProfile(parameters, user_data_dir); | 1409 Profile* profile = CreateProfile(parameters, user_data_dir); |
| 1404 if (!profile) | 1410 if (!profile) |
| 1405 return ResultCodes::NORMAL_EXIT; | 1411 return ResultCodes::NORMAL_EXIT; |
| 1406 | 1412 |
| 1407 // Post-profile init --------------------------------------------------------- | 1413 // Post-profile init --------------------------------------------------------- |
| 1408 | 1414 |
| 1409 PrefService* user_prefs = profile->GetPrefs(); | 1415 PrefService* user_prefs = profile->GetPrefs(); |
| 1410 DCHECK(user_prefs); | 1416 DCHECK(user_prefs); |
| 1411 | 1417 |
| 1412 // Tests should be able to tune login manager before showing it. | 1418 // Tests should be able to tune login manager before showing it. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1779 #if defined(OS_CHROMEOS) | 1785 #if defined(OS_CHROMEOS) |
| 1780 // To be precise, logout (browser shutdown) is not yet done, but the | 1786 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1781 // remaining work is negligible, hence we say LogoutDone here. | 1787 // remaining work is negligible, hence we say LogoutDone here. |
| 1782 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1788 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1783 false); | 1789 false); |
| 1784 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1790 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1785 #endif | 1791 #endif |
| 1786 TRACE_EVENT_END("BrowserMain", 0, 0); | 1792 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1787 return result_code; | 1793 return result_code; |
| 1788 } | 1794 } |
| OLD | NEW |