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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void BrowserMainParts::EarlyInitialization() { | 170 void BrowserMainParts::EarlyInitialization() { |
171 PreEarlyInitialization(); | 171 PreEarlyInitialization(); |
172 | 172 |
173 // Note: make sure to call ConnectionFieldTrial() before | 173 // Note: make sure to call ConnectionFieldTrial() before |
174 // ProxyConnectionsFieldTrial(). | 174 // ProxyConnectionsFieldTrial(). |
175 ConnectionFieldTrial(); | 175 ConnectionFieldTrial(); |
176 SocketTimeoutFieldTrial(); | 176 SocketTimeoutFieldTrial(); |
177 ProxyConnectionsFieldTrial(); | 177 ProxyConnectionsFieldTrial(); |
178 SpdyFieldTrial(); | 178 SpdyFieldTrial(); |
179 PrefetchFieldTrial(); | 179 PrefetchFieldTrial(); |
| 180 ConnectBackupJobsFieldTrial(); |
180 InitializeSSL(); | 181 InitializeSSL(); |
181 | 182 |
182 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts)) | 183 if (parsed_command_line().HasSwitch(switches::kEnableDNSSECCerts)) |
183 net::SSLConfigService::EnableDNSSEC(); | 184 net::SSLConfigService::EnableDNSSEC(); |
184 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart)) | 185 if (parsed_command_line().HasSwitch(switches::kDisableSSLFalseStart)) |
185 net::SSLConfigService::DisableFalseStart(); | 186 net::SSLConfigService::DisableFalseStart(); |
186 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies)) | 187 if (parsed_command_line().HasSwitch(switches::kAllowSSLMITMProxies)) |
187 net::SSLConfigService::AllowMITMProxies(); | 188 net::SSLConfigService::AllowMITMProxies(); |
188 | 189 |
189 PostEarlyInitialization(); | 190 PostEarlyInitialization(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); | 386 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); |
386 const int yes_prefetch_grp = | 387 const int yes_prefetch_grp = |
387 trial->AppendGroup("ContentPrefetchEnabled", | 388 trial->AppendGroup("ContentPrefetchEnabled", |
388 FieldTrial::kAllRemainingProbability); | 389 FieldTrial::kAllRemainingProbability); |
389 const int trial_grp = trial->group(); | 390 const int trial_grp = trial->group(); |
390 ResourceDispatcherHost::set_is_prefetch_enabled( | 391 ResourceDispatcherHost::set_is_prefetch_enabled( |
391 trial_grp == yes_prefetch_grp); | 392 trial_grp == yes_prefetch_grp); |
392 } | 393 } |
393 } | 394 } |
394 | 395 |
| 396 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is |
| 397 // specified, run an A/B test for automatically establishing backup TCP |
| 398 // connections when a certain timeout value is exceeded. |
| 399 void BrowserMainParts::ConnectBackupJobsFieldTrial() { |
| 400 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { |
| 401 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 402 true); |
| 403 } else if (parsed_command_line().HasSwitch( |
| 404 switches::kDisableConnectBackupJobs)) { |
| 405 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 406 false); |
| 407 } else { |
| 408 const FieldTrial::Probability kConnectBackupJobsDivisor = 100; |
| 409 // 50% probability. |
| 410 const FieldTrial::Probability kConnectBackupJobsProbability = 50; |
| 411 scoped_refptr<FieldTrial> trial = |
| 412 new FieldTrial("ConnnectBackupJobs", kConnectBackupJobsDivisor); |
| 413 const int connect_backup_jobs_enabled = |
| 414 trial->AppendGroup("ConnectBackupJobsEnabled", |
| 415 kConnectBackupJobsProbability); |
| 416 trial->AppendGroup("ConnectBackupJobsDisabled", |
| 417 FieldTrial::kAllRemainingProbability); |
| 418 const int trial_group = trial->group(); |
| 419 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 420 trial_group == connect_backup_jobs_enabled); |
| 421 } |
| 422 } |
| 423 |
395 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- | 424 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- |
396 | 425 |
397 void BrowserMainParts::MainMessageLoopStart() { | 426 void BrowserMainParts::MainMessageLoopStart() { |
398 PreMainMessageLoopStart(); | 427 PreMainMessageLoopStart(); |
399 | 428 |
400 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 429 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
401 | 430 |
402 // TODO(viettrungluu): should these really go before setting the thread name? | 431 // TODO(viettrungluu): should these really go before setting the thread name? |
403 system_monitor_.reset(new SystemMonitor); | 432 system_monitor_.reset(new SystemMonitor); |
404 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | 433 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 metrics->Stop(); | 1492 metrics->Stop(); |
1464 | 1493 |
1465 // browser_shutdown takes care of deleting browser_process, so we need to | 1494 // browser_shutdown takes care of deleting browser_process, so we need to |
1466 // release it. | 1495 // release it. |
1467 ignore_result(browser_process.release()); | 1496 ignore_result(browser_process.release()); |
1468 browser_shutdown::Shutdown(); | 1497 browser_shutdown::Shutdown(); |
1469 | 1498 |
1470 TRACE_EVENT_END("BrowserMain", 0, 0); | 1499 TRACE_EVENT_END("BrowserMain", 0, 0); |
1471 return result_code; | 1500 return result_code; |
1472 } | 1501 } |
OLD | NEW |