OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // This is an A/B test for the maximum number of persistent connections per | 207 // This is an A/B test for the maximum number of persistent connections per |
208 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 208 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
209 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 209 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
210 // run faster) uses 8. We would like to see how much of an effect this value has | 210 // run faster) uses 8. We would like to see how much of an effect this value has |
211 // on browsing. Too large a value might cause us to run into SYN flood detection | 211 // on browsing. Too large a value might cause us to run into SYN flood detection |
212 // mechanisms. | 212 // mechanisms. |
213 void BrowserMainParts::ConnectionFieldTrial() { | 213 void BrowserMainParts::ConnectionFieldTrial() { |
214 const base::FieldTrial::Probability kConnectDivisor = 100; | 214 const base::FieldTrial::Probability kConnectDivisor = 100; |
215 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | 215 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. |
216 | 216 |
217 scoped_refptr<base::FieldTrial> connect_trial = | 217 scoped_refptr<base::FieldTrial> connect_trial( |
218 new base::FieldTrial("ConnCountImpact", kConnectDivisor); | 218 new base::FieldTrial("ConnCountImpact", kConnectDivisor)); |
219 | 219 |
220 const int connect_5 = connect_trial->AppendGroup("conn_count_5", | 220 const int connect_5 = connect_trial->AppendGroup("conn_count_5", |
221 kConnectProbability); | 221 kConnectProbability); |
222 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | 222 const int connect_7 = connect_trial->AppendGroup("conn_count_7", |
223 kConnectProbability); | 223 kConnectProbability); |
224 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | 224 const int connect_8 = connect_trial->AppendGroup("conn_count_8", |
225 kConnectProbability); | 225 kConnectProbability); |
226 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | 226 const int connect_9 = connect_trial->AppendGroup("conn_count_9", |
227 kConnectProbability); | 227 kConnectProbability); |
228 // This (6) is the current default value. Having this group declared here | 228 // This (6) is the current default value. Having this group declared here |
(...skipping 23 matching lines...) Expand all Loading... |
252 // A/B test for determining a value for unused socket timeout. Currently the | 252 // A/B test for determining a value for unused socket timeout. Currently the |
253 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 253 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
254 // to take advantage of idle sockets. Setting it to too high could possibly | 254 // to take advantage of idle sockets. Setting it to too high could possibly |
255 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST | 255 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST |
256 // packet and possibly another RTT to re-establish the connection. | 256 // packet and possibly another RTT to re-establish the connection. |
257 void BrowserMainParts::SocketTimeoutFieldTrial() { | 257 void BrowserMainParts::SocketTimeoutFieldTrial() { |
258 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 258 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
259 // 1% probability for all experimental settings. | 259 // 1% probability for all experimental settings. |
260 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; | 260 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; |
261 | 261 |
262 scoped_refptr<base::FieldTrial> socket_timeout_trial = | 262 scoped_refptr<base::FieldTrial> socket_timeout_trial( |
263 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); | 263 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor)); |
264 | 264 |
265 const int socket_timeout_5 = | 265 const int socket_timeout_5 = |
266 socket_timeout_trial->AppendGroup("idle_timeout_5", | 266 socket_timeout_trial->AppendGroup("idle_timeout_5", |
267 kSocketTimeoutProbability); | 267 kSocketTimeoutProbability); |
268 const int socket_timeout_10 = | 268 const int socket_timeout_10 = |
269 socket_timeout_trial->AppendGroup("idle_timeout_10", | 269 socket_timeout_trial->AppendGroup("idle_timeout_10", |
270 kSocketTimeoutProbability); | 270 kSocketTimeoutProbability); |
271 const int socket_timeout_20 = | 271 const int socket_timeout_20 = |
272 socket_timeout_trial->AppendGroup("idle_timeout_20", | 272 socket_timeout_trial->AppendGroup("idle_timeout_20", |
273 kSocketTimeoutProbability); | 273 kSocketTimeoutProbability); |
(...skipping 14 matching lines...) Expand all Loading... |
288 } else { | 288 } else { |
289 NOTREACHED(); | 289 NOTREACHED(); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 void BrowserMainParts::ProxyConnectionsFieldTrial() { | 293 void BrowserMainParts::ProxyConnectionsFieldTrial() { |
294 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; | 294 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; |
295 // 25% probability | 295 // 25% probability |
296 const base::FieldTrial::Probability kProxyConnectionProbability = 1; | 296 const base::FieldTrial::Probability kProxyConnectionProbability = 1; |
297 | 297 |
298 scoped_refptr<base::FieldTrial> proxy_connection_trial = | 298 scoped_refptr<base::FieldTrial> proxy_connection_trial( |
299 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor); | 299 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor)); |
300 | 300 |
301 // The number of max sockets per group cannot be greater than the max number | 301 // The number of max sockets per group cannot be greater than the max number |
302 // of sockets per proxy server. We tried using 8, and it can easily | 302 // of sockets per proxy server. We tried using 8, and it can easily |
303 // lead to total browser stalls. | 303 // lead to total browser stalls. |
304 const int proxy_connections_16 = | 304 const int proxy_connections_16 = |
305 proxy_connection_trial->AppendGroup("proxy_connections_16", | 305 proxy_connection_trial->AppendGroup("proxy_connections_16", |
306 kProxyConnectionProbability); | 306 kProxyConnectionProbability); |
307 const int proxy_connections_64 = | 307 const int proxy_connections_64 = |
308 proxy_connection_trial->AppendGroup("proxy_connections_64", | 308 proxy_connection_trial->AppendGroup("proxy_connections_64", |
309 kProxyConnectionProbability); | 309 kProxyConnectionProbability); |
(...skipping 29 matching lines...) Expand all Loading... |
339 void BrowserMainParts::SpdyFieldTrial() { | 339 void BrowserMainParts::SpdyFieldTrial() { |
340 bool is_spdy_trial = false; | 340 bool is_spdy_trial = false; |
341 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { | 341 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { |
342 std::string spdy_mode = | 342 std::string spdy_mode = |
343 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); | 343 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); |
344 net::HttpNetworkLayer::EnableSpdy(spdy_mode); | 344 net::HttpNetworkLayer::EnableSpdy(spdy_mode); |
345 } else { | 345 } else { |
346 const base::FieldTrial::Probability kSpdyDivisor = 100; | 346 const base::FieldTrial::Probability kSpdyDivisor = 100; |
347 // 10% to preclude SPDY. | 347 // 10% to preclude SPDY. |
348 base::FieldTrial::Probability npnhttp_probability = 10; | 348 base::FieldTrial::Probability npnhttp_probability = 10; |
349 scoped_refptr<base::FieldTrial> trial = | 349 scoped_refptr<base::FieldTrial> trial( |
350 new base::FieldTrial("SpdyImpact", kSpdyDivisor); | 350 new base::FieldTrial("SpdyImpact", kSpdyDivisor)); |
351 // npn with only http support, no spdy. | 351 // npn with only http support, no spdy. |
352 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); | 352 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); |
353 // npn with spdy support. | 353 // npn with spdy support. |
354 int npn_spdy_grp = trial->AppendGroup("npn_with_spdy", | 354 int npn_spdy_grp = trial->AppendGroup("npn_with_spdy", |
355 base::FieldTrial::kAllRemainingProbability); | 355 base::FieldTrial::kAllRemainingProbability); |
356 int trial_grp = trial->group(); | 356 int trial_grp = trial->group(); |
357 if (trial_grp == npn_http_grp) { | 357 if (trial_grp == npn_http_grp) { |
358 is_spdy_trial = true; | 358 is_spdy_trial = true; |
359 net::HttpNetworkLayer::EnableSpdy("npn-http"); | 359 net::HttpNetworkLayer::EnableSpdy("npn-http"); |
360 } else if (trial_grp == npn_spdy_grp) { | 360 } else if (trial_grp == npn_spdy_grp) { |
(...skipping 16 matching lines...) Expand all Loading... |
377 // If neither --enable-content-prefetch or --disable-content-prefetch | 377 // If neither --enable-content-prefetch or --disable-content-prefetch |
378 // is set, users will not be in an A/B test for prefetching. | 378 // is set, users will not be in an A/B test for prefetching. |
379 void BrowserMainParts::PrefetchFieldTrial() { | 379 void BrowserMainParts::PrefetchFieldTrial() { |
380 if (parsed_command_line().HasSwitch(switches::kEnableContentPrefetch)) | 380 if (parsed_command_line().HasSwitch(switches::kEnableContentPrefetch)) |
381 ResourceDispatcherHost::set_is_prefetch_enabled(true); | 381 ResourceDispatcherHost::set_is_prefetch_enabled(true); |
382 else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { | 382 else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { |
383 ResourceDispatcherHost::set_is_prefetch_enabled(false); | 383 ResourceDispatcherHost::set_is_prefetch_enabled(false); |
384 } else { | 384 } else { |
385 const base::FieldTrial::Probability kPrefetchDivisor = 1000; | 385 const base::FieldTrial::Probability kPrefetchDivisor = 1000; |
386 const base::FieldTrial::Probability no_prefetch_probability = 500; | 386 const base::FieldTrial::Probability no_prefetch_probability = 500; |
387 scoped_refptr<base::FieldTrial> trial = | 387 scoped_refptr<base::FieldTrial> trial( |
388 new base::FieldTrial("Prefetch", kPrefetchDivisor); | 388 new base::FieldTrial("Prefetch", kPrefetchDivisor)); |
389 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); | 389 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); |
390 const int yes_prefetch_grp = | 390 const int yes_prefetch_grp = |
391 trial->AppendGroup("ContentPrefetchEnabled", | 391 trial->AppendGroup("ContentPrefetchEnabled", |
392 base::FieldTrial::kAllRemainingProbability); | 392 base::FieldTrial::kAllRemainingProbability); |
393 const int trial_grp = trial->group(); | 393 const int trial_grp = trial->group(); |
394 ResourceDispatcherHost::set_is_prefetch_enabled( | 394 ResourceDispatcherHost::set_is_prefetch_enabled( |
395 trial_grp == yes_prefetch_grp); | 395 trial_grp == yes_prefetch_grp); |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
399 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is | 399 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is |
400 // specified, run an A/B test for automatically establishing backup TCP | 400 // specified, run an A/B test for automatically establishing backup TCP |
401 // connections when a certain timeout value is exceeded. | 401 // connections when a certain timeout value is exceeded. |
402 void BrowserMainParts::ConnectBackupJobsFieldTrial() { | 402 void BrowserMainParts::ConnectBackupJobsFieldTrial() { |
403 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { | 403 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { |
404 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 404 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
405 true); | 405 true); |
406 } else if (parsed_command_line().HasSwitch( | 406 } else if (parsed_command_line().HasSwitch( |
407 switches::kDisableConnectBackupJobs)) { | 407 switches::kDisableConnectBackupJobs)) { |
408 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 408 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
409 false); | 409 false); |
410 } else { | 410 } else { |
411 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; | 411 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; |
412 // 1% probability. | 412 // 1% probability. |
413 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; | 413 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; |
414 scoped_refptr<base::FieldTrial> trial = | 414 scoped_refptr<base::FieldTrial> trial( |
415 new base::FieldTrial("ConnnectBackupJobs", | 415 new base::FieldTrial("ConnnectBackupJobs", |
416 kConnectBackupJobsDivisor); | 416 kConnectBackupJobsDivisor)); |
417 trial->AppendGroup("ConnectBackupJobsDisabled", | 417 trial->AppendGroup("ConnectBackupJobsDisabled", |
418 kConnectBackupJobsProbability); | 418 kConnectBackupJobsProbability); |
419 const int connect_backup_jobs_enabled = | 419 const int connect_backup_jobs_enabled = |
420 trial->AppendGroup("ConnectBackupJobsEnabled", | 420 trial->AppendGroup("ConnectBackupJobsEnabled", |
421 base::FieldTrial::kAllRemainingProbability); | 421 base::FieldTrial::kAllRemainingProbability); |
422 const int trial_group = trial->group(); | 422 const int trial_group = trial->group(); |
423 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 423 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
424 trial_group == connect_backup_jobs_enabled); | 424 trial_group == connect_backup_jobs_enabled); |
425 } | 425 } |
426 } | 426 } |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 // TODO(viettrungluu): why don't we run this earlier? | 1077 // TODO(viettrungluu): why don't we run this earlier? |
1078 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) | 1078 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) |
1079 WarnAboutMinimumSystemRequirements(); | 1079 WarnAboutMinimumSystemRequirements(); |
1080 | 1080 |
1081 InitializeNetworkOptions(parsed_command_line); | 1081 InitializeNetworkOptions(parsed_command_line); |
1082 | 1082 |
1083 // Initialize histogram synchronizer system. This is a singleton and is used | 1083 // Initialize histogram synchronizer system. This is a singleton and is used |
1084 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | 1084 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
1085 // scope. Even though NewRunnableMethod does AddRef and Release, the object | 1085 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
1086 // will not be deleted after the Task is executed. | 1086 // will not be deleted after the Task is executed. |
1087 scoped_refptr<HistogramSynchronizer> histogram_synchronizer = | 1087 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( |
1088 new HistogramSynchronizer(); | 1088 new HistogramSynchronizer()); |
1089 | 1089 |
1090 // Initialize the prefs of the local state. | 1090 // Initialize the prefs of the local state. |
1091 browser::RegisterLocalState(local_state); | 1091 browser::RegisterLocalState(local_state); |
1092 | 1092 |
1093 // Now that all preferences have been registered, set the install date | 1093 // Now that all preferences have been registered, set the install date |
1094 // for the uninstall metrics if this is our first run. This only actually | 1094 // for the uninstall metrics if this is our first run. This only actually |
1095 // gets used if the user has metrics reporting enabled at uninstall time. | 1095 // gets used if the user has metrics reporting enabled at uninstall time. |
1096 int64 install_date = | 1096 int64 install_date = |
1097 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); | 1097 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); |
1098 if (install_date == 0) { | 1098 if (install_date == 0) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 | 1381 |
1382 // Do initialize the plug-in service (and related preferences). | 1382 // Do initialize the plug-in service (and related preferences). |
1383 PluginService::InitGlobalInstance(profile); | 1383 PluginService::InitGlobalInstance(profile); |
1384 | 1384 |
1385 // Prepare for memory caching of SDCH dictionaries. | 1385 // Prepare for memory caching of SDCH dictionaries. |
1386 // Perform A/B test to measure global impact of SDCH support. | 1386 // Perform A/B test to measure global impact of SDCH support. |
1387 // Set up a field trial to see what disabling SDCH does to latency of page | 1387 // Set up a field trial to see what disabling SDCH does to latency of page |
1388 // layout globally. | 1388 // layout globally. |
1389 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; | 1389 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; |
1390 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. | 1390 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. |
1391 scoped_refptr<base::FieldTrial> sdch_trial = | 1391 scoped_refptr<base::FieldTrial> sdch_trial( |
1392 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR); | 1392 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR)); |
1393 | 1393 |
1394 // Use default of "" so that all domains are supported. | 1394 // Use default of "" so that all domains are supported. |
1395 std::string sdch_supported_domain(""); | 1395 std::string sdch_supported_domain(""); |
1396 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { | 1396 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { |
1397 sdch_supported_domain = | 1397 sdch_supported_domain = |
1398 parsed_command_line.GetSwitchValueASCII(switches::kSdchFilter); | 1398 parsed_command_line.GetSwitchValueASCII(switches::kSdchFilter); |
1399 } else { | 1399 } else { |
1400 sdch_trial->AppendGroup("global_disable_sdch", | 1400 sdch_trial->AppendGroup("global_disable_sdch", |
1401 kSDCH_DISABLE_PROBABILITY); | 1401 kSDCH_DISABLE_PROBABILITY); |
1402 int sdch_enabled = sdch_trial->AppendGroup("global_enable_sdch", | 1402 int sdch_enabled = sdch_trial->AppendGroup("global_enable_sdch", |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 metrics->Stop(); | 1572 metrics->Stop(); |
1573 | 1573 |
1574 // browser_shutdown takes care of deleting browser_process, so we need to | 1574 // browser_shutdown takes care of deleting browser_process, so we need to |
1575 // release it. | 1575 // release it. |
1576 ignore_result(browser_process.release()); | 1576 ignore_result(browser_process.release()); |
1577 browser_shutdown::Shutdown(); | 1577 browser_shutdown::Shutdown(); |
1578 | 1578 |
1579 TRACE_EVENT_END("BrowserMain", 0, 0); | 1579 TRACE_EVENT_END("BrowserMain", 0, 0); |
1580 return result_code; | 1580 return result_code; |
1581 } | 1581 } |
OLD | NEW |