| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 PostEarlyInitialization(); | 171 PostEarlyInitialization(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // This is an A/B test for the maximum number of persistent connections per | 174 // This is an A/B test for the maximum number of persistent connections per |
| 175 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 175 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
| 176 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 176 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
| 177 // run faster) uses 8. We would like to see how much of an effect this value has | 177 // run faster) uses 8. We would like to see how much of an effect this value has |
| 178 // on browsing. Too large a value might cause us to run into SYN flood detection | 178 // on browsing. Too large a value might cause us to run into SYN flood detection |
| 179 // mechanisms. | 179 // mechanisms. |
| 180 void BrowserMainParts::ConnectionFieldTrial() { | 180 void BrowserMainParts::ConnectionFieldTrial() { |
| 181 const FieldTrial::Probability kConnDivisor = 100; | 181 const FieldTrial::Probability kConnectDivisor = 100; |
| 182 const FieldTrial::Probability kConn16 = 10; // 10% probability | 182 const FieldTrial::Probability kConnectProbability = 20; // 20% probability |
| 183 const FieldTrial::Probability kRemainingConn = 30; // 30% probability | |
| 184 | 183 |
| 185 scoped_refptr<FieldTrial> conn_trial = | 184 scoped_refptr<FieldTrial> connect_trial = |
| 186 new FieldTrial("ConnCountImpact", kConnDivisor); | 185 new FieldTrial("ConnCountImpact", kConnectDivisor); |
| 187 | 186 |
| 188 const int conn_16 = conn_trial->AppendGroup("_conn_count_16", kConn16); | 187 const int connect_5 = connect_trial->AppendGroup("_conn_count_5", |
| 189 const int conn_4 = conn_trial->AppendGroup("_conn_count_4", kRemainingConn); | 188 kConnectProbability); |
| 190 const int conn_8 = conn_trial->AppendGroup("_conn_count_8", kRemainingConn); | 189 const int connect_6 = connect_trial->AppendGroup("_conn_count_6", |
| 191 const int conn_6 = conn_trial->AppendGroup("_conn_count_6", | 190 kConnectProbability); |
| 191 const int connect_7 = connect_trial->AppendGroup("_conn_count_7", |
| 192 kConnectProbability); |
| 193 const int connect_8 = connect_trial->AppendGroup("_conn_count_8", |
| 194 kConnectProbability); |
| 195 const int connect_9 = connect_trial->AppendGroup("_conn_count_9", |
| 192 FieldTrial::kAllRemainingProbability); | 196 FieldTrial::kAllRemainingProbability); |
| 193 | 197 |
| 194 const int conn_trial_grp = conn_trial->group(); | 198 const int connect_trial_group = connect_trial->group(); |
| 195 | 199 |
| 196 if (conn_trial_grp == conn_4) { | 200 if (connect_trial_group == connect_5) { |
| 197 net::HttpNetworkSession::set_max_sockets_per_group(4); | 201 net::HttpNetworkSession::set_max_sockets_per_group(5); |
| 198 } else if (conn_trial_grp == conn_6) { | 202 } else if (connect_trial_group == connect_6) { |
| 199 // This (6) is the current default value. | 203 // This (6) is the current default value. |
| 200 net::HttpNetworkSession::set_max_sockets_per_group(6); | 204 net::HttpNetworkSession::set_max_sockets_per_group(6); |
| 201 } else if (conn_trial_grp == conn_8) { | 205 } else if (connect_trial_group == connect_7) { |
| 206 net::HttpNetworkSession::set_max_sockets_per_group(7); |
| 207 } else if (connect_trial_group == connect_8) { |
| 202 net::HttpNetworkSession::set_max_sockets_per_group(8); | 208 net::HttpNetworkSession::set_max_sockets_per_group(8); |
| 203 } else if (conn_trial_grp == conn_16) { | 209 } else if (connect_trial_group == connect_9) { |
| 204 net::HttpNetworkSession::set_max_sockets_per_group(16); | 210 net::HttpNetworkSession::set_max_sockets_per_group(9); |
| 205 } else { | 211 } else { |
| 206 NOTREACHED(); | 212 NOTREACHED(); |
| 207 } | 213 } |
| 208 } | 214 } |
| 209 | 215 |
| 210 // A/B test for determining a value for unused socket timeout. Currently the | 216 // A/B test for determining a value for unused socket timeout. Currently the |
| 211 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 217 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
| 212 // to take advantage of idle sockets. Setting it to too high could possibly | 218 // to take advantage of idle sockets. Setting it to too high could possibly |
| 213 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST | 219 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST |
| 214 // packet and possibly another RTT to re-establish the connection. | 220 // packet and possibly another RTT to re-establish the connection. |
| 215 void BrowserMainParts::SocketTimeoutFieldTrial() { | 221 void BrowserMainParts::SocketTimeoutFieldTrial() { |
| 216 const FieldTrial::Probability kIdleSktToDivisor = 100; // Idle socket timeout | 222 const FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
| 217 const FieldTrial::Probability kSktToProb = 25; // 25% probability | 223 // 25% probability |
| 224 const FieldTrial::Probability kSocketTimeoutProbability = 25; |
| 218 | 225 |
| 219 scoped_refptr<FieldTrial> socket_timeout_trial = | 226 scoped_refptr<FieldTrial> socket_timeout_trial = |
| 220 new FieldTrial("IdleSktToImpact", kIdleSktToDivisor); | 227 new FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); |
| 221 | 228 |
| 222 const int socket_timeout_5 = | 229 const int socket_timeout_5 = |
| 223 socket_timeout_trial->AppendGroup("_idle_timeout_5", kSktToProb); | 230 socket_timeout_trial->AppendGroup("_idle_timeout_5", |
| 231 kSocketTimeoutProbability); |
| 224 const int socket_timeout_10 = | 232 const int socket_timeout_10 = |
| 225 socket_timeout_trial->AppendGroup("_idle_timeout_10", kSktToProb); | 233 socket_timeout_trial->AppendGroup("_idle_timeout_10", |
| 234 kSocketTimeoutProbability); |
| 226 const int socket_timeout_20 = | 235 const int socket_timeout_20 = |
| 227 socket_timeout_trial->AppendGroup("_idle_timeout_20", kSktToProb); | 236 socket_timeout_trial->AppendGroup("_idle_timeout_20", |
| 237 kSocketTimeoutProbability); |
| 228 const int socket_timeout_60 = | 238 const int socket_timeout_60 = |
| 229 socket_timeout_trial->AppendGroup("_idle_timeout_60", | 239 socket_timeout_trial->AppendGroup("_idle_timeout_60", |
| 230 FieldTrial::kAllRemainingProbability); | 240 FieldTrial::kAllRemainingProbability); |
| 231 | 241 |
| 232 const int idle_to_trial_grp = socket_timeout_trial->group(); | 242 const int idle_to_trial_group = socket_timeout_trial->group(); |
| 233 | 243 |
| 234 if (idle_to_trial_grp == socket_timeout_5) { | 244 if (idle_to_trial_group == socket_timeout_5) { |
| 235 net::ClientSocketPool::set_unused_idle_socket_timeout(5); | 245 net::ClientSocketPool::set_unused_idle_socket_timeout(5); |
| 236 } else if (idle_to_trial_grp == socket_timeout_10) { | 246 } else if (idle_to_trial_group == socket_timeout_10) { |
| 237 // This (10 seconds) is the current default value. | 247 // This (10 seconds) is the current default value. |
| 238 net::ClientSocketPool::set_unused_idle_socket_timeout(10); | 248 net::ClientSocketPool::set_unused_idle_socket_timeout(10); |
| 239 } else if (idle_to_trial_grp == socket_timeout_20) { | 249 } else if (idle_to_trial_group == socket_timeout_20) { |
| 240 net::ClientSocketPool::set_unused_idle_socket_timeout(20); | 250 net::ClientSocketPool::set_unused_idle_socket_timeout(20); |
| 241 } else if (idle_to_trial_grp == socket_timeout_60) { | 251 } else if (idle_to_trial_group == socket_timeout_60) { |
| 242 net::ClientSocketPool::set_unused_idle_socket_timeout(60); | 252 net::ClientSocketPool::set_unused_idle_socket_timeout(60); |
| 243 } else { | 253 } else { |
| 244 NOTREACHED(); | 254 NOTREACHED(); |
| 245 } | 255 } |
| 246 } | 256 } |
| 247 | 257 |
| 248 // When --use-spdy not set, users will be in A/B test for spdy. | 258 // When --use-spdy not set, users will be in A/B test for spdy. |
| 249 // group A (npn_with_spdy): this means npn and spdy are enabled. In case server | 259 // group A (npn_with_spdy): this means npn and spdy are enabled. In case server |
| 250 // supports spdy, browser will use spdy. | 260 // supports spdy, browser will use spdy. |
| 251 // group B (npn_with_http): this means npn is enabled but spdy won't be used. | 261 // group B (npn_with_http): this means npn is enabled but spdy won't be used. |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 | 1307 |
| 1298 metrics->Stop(); | 1308 metrics->Stop(); |
| 1299 | 1309 |
| 1300 // browser_shutdown takes care of deleting browser_process, so we need to | 1310 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1301 // release it. | 1311 // release it. |
| 1302 ignore_result(browser_process.release()); | 1312 ignore_result(browser_process.release()); |
| 1303 browser_shutdown::Shutdown(); | 1313 browser_shutdown::Shutdown(); |
| 1304 | 1314 |
| 1305 return result_code; | 1315 return result_code; |
| 1306 } | 1316 } |
| OLD | NEW |