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