| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 kConnectProbability); | 651 kConnectProbability); |
| 652 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | 652 const int connect_7 = connect_trial->AppendGroup("conn_count_7", |
| 653 kConnectProbability); | 653 kConnectProbability); |
| 654 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | 654 const int connect_8 = connect_trial->AppendGroup("conn_count_8", |
| 655 kConnectProbability); | 655 kConnectProbability); |
| 656 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | 656 const int connect_9 = connect_trial->AppendGroup("conn_count_9", |
| 657 kConnectProbability); | 657 kConnectProbability); |
| 658 | 658 |
| 659 const int connect_trial_group = connect_trial->group(); | 659 const int connect_trial_group = connect_trial->group(); |
| 660 | 660 |
| 661 int max_sockets = 0; |
| 661 if (connect_trial_group == connect_5) { | 662 if (connect_trial_group == connect_5) { |
| 662 net::ClientSocketPoolManager::set_max_sockets_per_group(5); | 663 max_sockets = 5; |
| 663 } else if (connect_trial_group == connect_6) { | 664 } else if (connect_trial_group == connect_6) { |
| 664 net::ClientSocketPoolManager::set_max_sockets_per_group(6); | 665 max_sockets = 6; |
| 665 } else if (connect_trial_group == connect_7) { | 666 } else if (connect_trial_group == connect_7) { |
| 666 net::ClientSocketPoolManager::set_max_sockets_per_group(7); | 667 max_sockets = 7; |
| 667 } else if (connect_trial_group == connect_8) { | 668 } else if (connect_trial_group == connect_8) { |
| 668 net::ClientSocketPoolManager::set_max_sockets_per_group(8); | 669 max_sockets = 8; |
| 669 } else if (connect_trial_group == connect_9) { | 670 } else if (connect_trial_group == connect_9) { |
| 670 net::ClientSocketPoolManager::set_max_sockets_per_group(9); | 671 max_sockets = 9; |
| 671 } else { | 672 } else { |
| 672 NOTREACHED(); | 673 NOTREACHED(); |
| 673 } | 674 } |
| 675 net::ClientSocketPoolManager::set_max_sockets_per_group( |
| 676 net::HttpNetworkSession::NORMAL_SOCKET_POOL, max_sockets); |
| 674 } | 677 } |
| 675 | 678 |
| 676 // A/B test for determining a value for unused socket timeout. Currently the | 679 // A/B test for determining a value for unused socket timeout. Currently the |
| 677 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 680 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
| 678 // to take advantage of idle sockets. Setting it to too high could possibly | 681 // to take advantage of idle sockets. Setting it to too high could possibly |
| 679 // result in more ERR_CONNECTION_RESETs, since some servers will kill a socket | 682 // result in more ERR_CONNECTION_RESETs, since some servers will kill a socket |
| 680 // before we time it out. Since these are "unused" sockets, we won't retry the | 683 // before we time it out. Since these are "unused" sockets, we won't retry the |
| 681 // connection and instead show an error to the user. So we need to be | 684 // connection and instead show an error to the user. So we need to be |
| 682 // conservative here. We've seen that some servers will close the socket after | 685 // conservative here. We've seen that some servers will close the socket after |
| 683 // as short as 10 seconds. See http://crbug.com/84313 for more details. | 686 // as short as 10 seconds. See http://crbug.com/84313 for more details. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 // lead to total browser stalls. | 739 // lead to total browser stalls. |
| 737 const int proxy_connections_16 = | 740 const int proxy_connections_16 = |
| 738 proxy_connection_trial->AppendGroup("proxy_connections_16", | 741 proxy_connection_trial->AppendGroup("proxy_connections_16", |
| 739 kProxyConnectionProbability); | 742 kProxyConnectionProbability); |
| 740 const int proxy_connections_64 = | 743 const int proxy_connections_64 = |
| 741 proxy_connection_trial->AppendGroup("proxy_connections_64", | 744 proxy_connection_trial->AppendGroup("proxy_connections_64", |
| 742 kProxyConnectionProbability); | 745 kProxyConnectionProbability); |
| 743 | 746 |
| 744 const int proxy_connections_trial_group = proxy_connection_trial->group(); | 747 const int proxy_connections_trial_group = proxy_connection_trial->group(); |
| 745 | 748 |
| 749 int max_sockets = 0; |
| 746 if (proxy_connections_trial_group == proxy_connections_16) { | 750 if (proxy_connections_trial_group == proxy_connections_16) { |
| 747 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(16); | 751 max_sockets = 16; |
| 748 } else if (proxy_connections_trial_group == proxy_connections_32) { | 752 } else if (proxy_connections_trial_group == proxy_connections_32) { |
| 749 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(32); | 753 max_sockets = 32; |
| 750 } else if (proxy_connections_trial_group == proxy_connections_64) { | 754 } else if (proxy_connections_trial_group == proxy_connections_64) { |
| 751 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(64); | 755 max_sockets = 64; |
| 752 } else { | 756 } else { |
| 753 NOTREACHED(); | 757 NOTREACHED(); |
| 754 } | 758 } |
| 759 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 760 net::HttpNetworkSession::NORMAL_SOCKET_POOL, max_sockets); |
| 755 } | 761 } |
| 756 | 762 |
| 757 // When --use-spdy not set, users will be in A/B test for spdy. | 763 // When --use-spdy not set, users will be in A/B test for spdy. |
| 758 // group A (npn_with_spdy): this means npn and spdy are enabled. In case server | 764 // group A (npn_with_spdy): this means npn and spdy are enabled. In case server |
| 759 // supports spdy, browser will use spdy. | 765 // supports spdy, browser will use spdy. |
| 760 // group B (npn_with_http): this means npn is enabled but spdy won't be used. | 766 // group B (npn_with_http): this means npn is enabled but spdy won't be used. |
| 761 // Http is still used for all requests. | 767 // Http is still used for all requests. |
| 762 // default group: no npn or spdy is involved. The "old" non-spdy | 768 // default group: no npn or spdy is involved. The "old" non-spdy |
| 763 // chrome behavior. | 769 // chrome behavior. |
| 764 void ChromeBrowserMainParts::SpdyFieldTrial() { | 770 void ChromeBrowserMainParts::SpdyFieldTrial() { |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1949 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1944 uma_name += "_XP"; | 1950 uma_name += "_XP"; |
| 1945 | 1951 |
| 1946 uma_name += "_PreRead_"; | 1952 uma_name += "_PreRead_"; |
| 1947 uma_name += pre_read_percentage; | 1953 uma_name += pre_read_percentage; |
| 1948 AddPreReadHistogramTime(uma_name.c_str(), time); | 1954 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1949 } | 1955 } |
| 1950 #endif | 1956 #endif |
| 1951 #endif | 1957 #endif |
| 1952 } | 1958 } |
| OLD | NEW |