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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 #endif // OS_POSIX | 708 #endif // OS_POSIX |
709 | 709 |
710 #if defined(OS_WIN) | 710 #if defined(OS_WIN) |
711 // Initialize Winsock. | 711 // Initialize Winsock. |
712 net::EnsureWinsockInit(); | 712 net::EnsureWinsockInit(); |
713 #endif // defined(OS_WIN) | 713 #endif // defined(OS_WIN) |
714 | 714 |
715 // Initialize statistical testing infrastructure for entire browser. | 715 // Initialize statistical testing infrastructure for entire browser. |
716 FieldTrialList field_trial; | 716 FieldTrialList field_trial; |
717 | 717 |
| 718 // This is an A/B test for the maximum number of persistent connections per |
| 719 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. |
| 720 // Safari uses 4, and Fasterfox (a plugin for Firefox that supposedly |
| 721 // configures it to run faster) uses 8. We would like to see how much of an |
| 722 // effect this value has on browsing. Too large a value might cause us to |
| 723 // run into SYN flood detection mechanisms. |
| 724 const FieldTrial::Probability kConnDivisor = 100; |
| 725 const FieldTrial::Probability kConn16 = 10; // 10% probability |
| 726 const FieldTrial::Probability kRemainingConn = 30; // 30% probability |
| 727 |
| 728 scoped_refptr<FieldTrial> conn_trial = |
| 729 new FieldTrial("ConnCountImpact", kConnDivisor); |
| 730 |
| 731 const int conn_16 = conn_trial->AppendGroup("_conn_count_16", kConn16); |
| 732 const int conn_4 = conn_trial->AppendGroup("_conn_count_4", kRemainingConn); |
| 733 const int conn_8 = conn_trial->AppendGroup("_conn_count_8", kRemainingConn); |
| 734 const int conn_6 = conn_trial->AppendGroup("_conn_count_6", |
| 735 FieldTrial::kAllRemainingProbability); |
| 736 |
| 737 const int conn_trial_grp = conn_trial->group(); |
| 738 |
| 739 if (conn_trial_grp == conn_4) { |
| 740 net::HttpNetworkSession::set_max_sockets_per_group(4); |
| 741 } else if (conn_trial_grp == conn_6) { |
| 742 // This is the current default value. |
| 743 net::HttpNetworkSession::set_max_sockets_per_group(6); |
| 744 } else if (conn_trial_grp == conn_8) { |
| 745 net::HttpNetworkSession::set_max_sockets_per_group(8); |
| 746 } else if (conn_trial_grp == conn_16) { |
| 747 net::HttpNetworkSession::set_max_sockets_per_group(16); |
| 748 } else { |
| 749 DCHECK(false); |
| 750 } |
| 751 |
| 752 |
718 // When --use-spdy not set, users will be in A/B test for spdy. | 753 // When --use-spdy not set, users will be in A/B test for spdy. |
719 // group A (_npn_with_spdy): this means npn and spdy are enabled. In | 754 // group A (_npn_with_spdy): this means npn and spdy are enabled. In |
720 // case server supports spdy, browser will use spdy. | 755 // case server supports spdy, browser will use spdy. |
721 // group B (_npn_with_http): this means npn is enabled but spdy | 756 // group B (_npn_with_http): this means npn is enabled but spdy |
722 // won't be used. Http is still used for all requests. | 757 // won't be used. Http is still used for all requests. |
723 // default group: no npn or spdy is involved. The "old" non-spdy chrome | 758 // default group: no npn or spdy is involved. The "old" non-spdy chrome |
724 // behavior. | 759 // behavior. |
725 bool is_spdy_trial = false; | 760 bool is_spdy_trial = false; |
726 if (parsed_command_line.HasSwitch(switches::kUseSpdy)) { | 761 if (parsed_command_line.HasSwitch(switches::kUseSpdy)) { |
727 std::string spdy_mode = | 762 std::string spdy_mode = |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 | 1354 |
1320 metrics->Stop(); | 1355 metrics->Stop(); |
1321 | 1356 |
1322 // browser_shutdown takes care of deleting browser_process, so we need to | 1357 // browser_shutdown takes care of deleting browser_process, so we need to |
1323 // release it. | 1358 // release it. |
1324 ignore_result(browser_process.release()); | 1359 ignore_result(browser_process.release()); |
1325 browser_shutdown::Shutdown(); | 1360 browser_shutdown::Shutdown(); |
1326 | 1361 |
1327 return result_code; | 1362 return result_code; |
1328 } | 1363 } |
OLD | NEW |