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

Side by Side Diff: chrome/browser/browser_main.cc

Issue 6354023: Added a function to BrowserMainParts that is called after about_flags has con... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/browser_main.h ('k') | no next file » | 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) 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 BrowserMainParts::~BrowserMainParts() { 187 BrowserMainParts::~BrowserMainParts() {
188 } 188 }
189 189
190 // BrowserMainParts: |EarlyInitialization()| and related ----------------------- 190 // BrowserMainParts: |EarlyInitialization()| and related -----------------------
191 191
192 void BrowserMainParts::EarlyInitialization() { 192 void BrowserMainParts::EarlyInitialization() {
193 PreEarlyInitialization(); 193 PreEarlyInitialization();
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();
cbentzel 2011/01/25 22:51:41 Why didn't this move to SetupFieldTrials? Did it n
dominich 2011/01/25 22:59:26 My first thought was that it isn't enabled through
197 197
198 // Note: make sure to call ConnectionFieldTrial() before
199 // ProxyConnectionsFieldTrial().
200 ConnectionFieldTrial();
201 SocketTimeoutFieldTrial();
202 ProxyConnectionsFieldTrial();
203 SpdyFieldTrial();
204 PrefetchFieldTrial();
205 ConnectBackupJobsFieldTrial();
206 InitializeSSL(); 198 InitializeSSL();
207 199
208 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts)) 200 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts))
209 net::SSLConfigService::EnableDNSSEC(); 201 net::SSLConfigService::EnableDNSSEC();
210 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart)) 202 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart))
211 net::SSLConfigService::DisableFalseStart(); 203 net::SSLConfigService::DisableFalseStart();
212 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies)) 204 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies))
213 net::SSLConfigService::AllowMITMProxies(); 205 net::SSLConfigService::AllowMITMProxies();
214 // Disabled to stop people playing with it. 206 // Disabled to stop people playing with it.
215 // if (parsed_command_line().HasSwitch(switches::kEnableSnapStart)) 207 // if (parsed_command_line().HasSwitch(switches::kEnableSnapStart))
216 // net::SSLConfigService::EnableSnapStart(); 208 // net::SSLConfigService::EnableSnapStart();
217 if (parsed_command_line().HasSwitch( 209 if (parsed_command_line().HasSwitch(
218 switches::kEnableDNSCertProvenanceChecking)) { 210 switches::kEnableDNSCertProvenanceChecking)) {
219 net::SSLConfigService::EnableDNSCertProvenanceChecking(); 211 net::SSLConfigService::EnableDNSCertProvenanceChecking();
220 } 212 }
221 213
222 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen)) 214 if (parsed_command_line().HasSwitch(switches::kEnableTcpFastOpen))
223 net::set_tcp_fastopen_enabled(true); 215 net::set_tcp_fastopen_enabled(true);
224 216
225 PostEarlyInitialization(); 217 PostEarlyInitialization();
226 } 218 }
227 219
220 // This will be called after the command-line has been mutated by about:flags
221 void BrowserMainParts::SetupFieldTrials() {
222 // Note: make sure to call ConnectionFieldTrial() before
223 // ProxyConnectionsFieldTrial().
224 ConnectionFieldTrial();
225 SocketTimeoutFieldTrial();
226 ProxyConnectionsFieldTrial();
227 PrefetchFieldTrial();
228 SpdyFieldTrial();
229 ConnectBackupJobsFieldTrial();
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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( 1248 scoped_refptr<HistogramSynchronizer> histogram_synchronizer(
1245 new HistogramSynchronizer()); 1249 new HistogramSynchronizer());
1246 1250
1247 // Initialize the prefs of the local state. 1251 // Initialize the prefs of the local state.
1248 browser::RegisterLocalState(local_state); 1252 browser::RegisterLocalState(local_state);
1249 1253
1250 // Convert active labs into switches. Modifies the current command line. 1254 // Convert active labs into switches. Modifies the current command line.
1251 about_flags::ConvertFlagsToSwitches(local_state, 1255 about_flags::ConvertFlagsToSwitches(local_state,
1252 CommandLine::ForCurrentProcess()); 1256 CommandLine::ForCurrentProcess());
1253 1257
1258 // Now the command line has been mutated based on about:flags, we can run some
1259 // field trials
Nico 2011/01/25 22:58:07 Nit "." at end of comment
1260 parts->SetupFieldTrials();
1261
1254 // Now that all preferences have been registered, set the install date 1262 // 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 1263 // 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. 1264 // gets used if the user has metrics reporting enabled at uninstall time.
1257 int64 install_date = 1265 int64 install_date =
1258 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); 1266 local_state->GetInt64(prefs::kUninstallMetricsInstallDate);
1259 if (install_date == 0) { 1267 if (install_date == 0) {
1260 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, 1268 local_state->SetInt64(prefs::kUninstallMetricsInstallDate,
1261 base::Time::Now().ToTimeT()); 1269 base::Time::Now().ToTimeT());
1262 } 1270 }
1263 1271
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698