Chromium Code Reviews| 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_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 99 |
| 100 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( | 100 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( |
| 101 const CommandLine& parsed_command_line) : | 101 const CommandLine& parsed_command_line) : |
| 102 parsed_command_line_(parsed_command_line) { | 102 parsed_command_line_(parsed_command_line) { |
| 103 } | 103 } |
| 104 | 104 |
| 105 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { | 105 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ChromeBrowserFieldTrials::SetupFieldTrials(bool proxy_policy_is_set) { | 108 void ChromeBrowserFieldTrials::SetupFieldTrials(bool proxy_policy_is_set) { |
| 109 // Note: make sure to call ConnectionFieldTrial() before | |
| 110 // ProxyConnectionsFieldTrial(). | |
| 111 ConnectionFieldTrial(); | |
| 112 SocketTimeoutFieldTrial(); | 109 SocketTimeoutFieldTrial(); |
| 113 // If a policy is defining the number of active connections this field test | 110 // If a policy is defining the number of active connections this field test |
| 114 // shoud not be performed. | 111 // shoud not be performed. |
| 115 if (!proxy_policy_is_set) | 112 if (!proxy_policy_is_set) |
| 116 ProxyConnectionsFieldTrial(); | 113 ProxyConnectionsFieldTrial(); |
| 117 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); | 114 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); |
| 118 SpdyFieldTrial(); | 115 SpdyFieldTrial(); |
| 119 ConnectBackupJobsFieldTrial(); | 116 ConnectBackupJobsFieldTrial(); |
| 120 WarmConnectionFieldTrial(); | 117 WarmConnectionFieldTrial(); |
| 121 PredictorFieldTrial(); | 118 PredictorFieldTrial(); |
| 122 DefaultAppsFieldTrial(); | 119 DefaultAppsFieldTrial(); |
| 123 AutoLaunchChromeFieldTrial(); | 120 AutoLaunchChromeFieldTrial(); |
| 124 gpu_util::InitializeCompositingFieldTrial(); | 121 gpu_util::InitializeCompositingFieldTrial(); |
| 125 gpu_util::InitializeStage3DFieldTrial(); | 122 gpu_util::InitializeStage3DFieldTrial(); |
| 126 SetupUniformityFieldTrials(); | 123 SetupUniformityFieldTrials(); |
| 127 AutocompleteFieldTrial::Activate(); | 124 AutocompleteFieldTrial::Activate(); |
| 128 DisableNewTabFieldTrialIfNecesssary(); | 125 DisableNewTabFieldTrialIfNecesssary(); |
| 129 SetUpSafeBrowsingInterstitialFieldTrial(); | 126 SetUpSafeBrowsingInterstitialFieldTrial(); |
| 130 SetUpInfiniteCacheFieldTrial(); | 127 SetUpInfiniteCacheFieldTrial(); |
| 131 SetUpCacheSensitivityAnalysisFieldTrial(); | 128 SetUpCacheSensitivityAnalysisFieldTrial(); |
| 132 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 129 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 133 OneClickSigninHelper::InitializeFieldTrial(); | 130 OneClickSigninHelper::InitializeFieldTrial(); |
| 134 #endif | 131 #endif |
| 135 } | 132 } |
| 136 | 133 |
| 137 // This is an A/B test for the maximum number of persistent connections per | |
| 138 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | |
| 139 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | |
| 140 // run faster) uses 8. We would like to see how much of an effect this value has | |
| 141 // on browsing. Too large a value might cause us to run into SYN flood detection | |
| 142 // mechanisms. | |
| 143 void ChromeBrowserFieldTrials::ConnectionFieldTrial() { | |
| 144 const base::FieldTrial::Probability kConnectDivisor = 100; | |
| 145 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | |
| 146 | |
| 147 // This (6) is the current default value. Having this group declared here | |
| 148 // makes it straightforward to modify |kConnectProbability| such that the same | |
| 149 // probability value will be assigned to all the other groups, while | |
| 150 // preserving the remainder of the of probability space to the default value. | |
| 151 int connect_6 = -1; | |
| 152 | |
| 153 // After June 30, 2011 builds, it will always be in default group. | |
| 154 scoped_refptr<base::FieldTrial> connect_trial( | |
| 155 base::FieldTrialList::FactoryGetFieldTrial( | |
| 156 "ConnCountImpact", kConnectDivisor, "conn_count_6", 2011, 6, 30, | |
| 157 &connect_6)); | |
| 158 | |
| 159 const int connect_5 = connect_trial->AppendGroup("conn_count_5", | |
| 160 kConnectProbability); | |
| 161 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | |
| 162 kConnectProbability); | |
| 163 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | |
| 164 kConnectProbability); | |
| 165 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | |
| 166 kConnectProbability); | |
| 167 | |
| 168 const int connect_trial_group = connect_trial->group(); | |
| 169 | |
| 170 int max_sockets = 0; | |
| 171 if (connect_trial_group == connect_5) { | |
| 172 max_sockets = 5; | |
| 173 } else if (connect_trial_group == connect_6) { | |
| 174 max_sockets = 6; | |
|
SteveT
2012/10/19 18:59:55
I'm guessing I need to set this as a constant some
| |
| 175 } else if (connect_trial_group == connect_7) { | |
| 176 max_sockets = 7; | |
| 177 } else if (connect_trial_group == connect_8) { | |
| 178 max_sockets = 8; | |
| 179 } else if (connect_trial_group == connect_9) { | |
| 180 max_sockets = 9; | |
| 181 } else { | |
| 182 NOTREACHED(); | |
| 183 } | |
| 184 net::ClientSocketPoolManager::set_max_sockets_per_group( | |
| 185 net::HttpNetworkSession::NORMAL_SOCKET_POOL, max_sockets); | |
| 186 } | |
| 187 | |
| 188 // A/B test for determining a value for unused socket timeout. Currently the | 134 // A/B test for determining a value for unused socket timeout. Currently the |
| 189 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 135 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
| 190 // to take advantage of idle sockets. Setting it to too high could possibly | 136 // to take advantage of idle sockets. Setting it to too high could possibly |
| 191 // result in more ERR_CONNECTION_RESETs, since some servers will kill a socket | 137 // result in more ERR_CONNECTION_RESETs, since some servers will kill a socket |
| 192 // before we time it out. Since these are "unused" sockets, we won't retry the | 138 // before we time it out. Since these are "unused" sockets, we won't retry the |
| 193 // connection and instead show an error to the user. So we need to be | 139 // connection and instead show an error to the user. So we need to be |
| 194 // conservative here. We've seen that some servers will close the socket after | 140 // conservative here. We've seen that some servers will close the socket after |
| 195 // as short as 10 seconds. See http://crbug.com/84313 for more details. | 141 // as short as 10 seconds. See http://crbug.com/84313 for more details. |
| 196 void ChromeBrowserFieldTrials::SocketTimeoutFieldTrial() { | 142 void ChromeBrowserFieldTrials::SocketTimeoutFieldTrial() { |
| 197 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 143 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 2012, 12, 31, NULL)); | 526 2012, 12, 31, NULL)); |
| 581 trial->AppendGroup("ControlA", sensitivity_analysis_probability); | 527 trial->AppendGroup("ControlA", sensitivity_analysis_probability); |
| 582 trial->AppendGroup("ControlB", sensitivity_analysis_probability); | 528 trial->AppendGroup("ControlB", sensitivity_analysis_probability); |
| 583 trial->AppendGroup("100A", sensitivity_analysis_probability); | 529 trial->AppendGroup("100A", sensitivity_analysis_probability); |
| 584 trial->AppendGroup("100B", sensitivity_analysis_probability); | 530 trial->AppendGroup("100B", sensitivity_analysis_probability); |
| 585 trial->AppendGroup("200A", sensitivity_analysis_probability); | 531 trial->AppendGroup("200A", sensitivity_analysis_probability); |
| 586 trial->AppendGroup("200B", sensitivity_analysis_probability); | 532 trial->AppendGroup("200B", sensitivity_analysis_probability); |
| 587 trial->AppendGroup("400A", sensitivity_analysis_probability); | 533 trial->AppendGroup("400A", sensitivity_analysis_probability); |
| 588 trial->AppendGroup("400B", sensitivity_analysis_probability); | 534 trial->AppendGroup("400B", sensitivity_analysis_probability); |
| 589 } | 535 } |
| OLD | NEW |