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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // mechanisms. | 182 // mechanisms. |
183 void BrowserMainParts::ConnectionFieldTrial() { | 183 void BrowserMainParts::ConnectionFieldTrial() { |
184 const FieldTrial::Probability kConnectDivisor = 100; | 184 const FieldTrial::Probability kConnectDivisor = 100; |
185 const FieldTrial::Probability kConnectProbability = 20; // 20% probability | 185 const FieldTrial::Probability kConnectProbability = 20; // 20% probability |
186 | 186 |
187 scoped_refptr<FieldTrial> connect_trial = | 187 scoped_refptr<FieldTrial> connect_trial = |
188 new FieldTrial("ConnCountImpact", kConnectDivisor); | 188 new FieldTrial("ConnCountImpact", kConnectDivisor); |
189 | 189 |
190 const int connect_5 = connect_trial->AppendGroup("_conn_count_5", | 190 const int connect_5 = connect_trial->AppendGroup("_conn_count_5", |
191 kConnectProbability); | 191 kConnectProbability); |
192 const int connect_6 = connect_trial->AppendGroup("_conn_count_6", | |
193 kConnectProbability); | |
194 const int connect_7 = connect_trial->AppendGroup("_conn_count_7", | 192 const int connect_7 = connect_trial->AppendGroup("_conn_count_7", |
195 kConnectProbability); | 193 kConnectProbability); |
196 const int connect_8 = connect_trial->AppendGroup("_conn_count_8", | 194 const int connect_8 = connect_trial->AppendGroup("_conn_count_8", |
197 kConnectProbability); | 195 kConnectProbability); |
198 const int connect_9 = connect_trial->AppendGroup("_conn_count_9", | 196 const int connect_9 = connect_trial->AppendGroup("_conn_count_9", |
| 197 kConnectProbability); |
| 198 // This (6) is the current default value. Having this group declared here |
| 199 // makes it straightforward to modify |kConnectProbability| such that the same |
| 200 // probability value will be assigned to all the other groups, while |
| 201 // preserving the remainder of the of probability space to the default value. |
| 202 const int connect_6 = connect_trial->AppendGroup("_conn_count_6", |
199 FieldTrial::kAllRemainingProbability); | 203 FieldTrial::kAllRemainingProbability); |
200 | 204 |
201 const int connect_trial_group = connect_trial->group(); | 205 const int connect_trial_group = connect_trial->group(); |
202 | 206 |
203 if (connect_trial_group == connect_5) { | 207 if (connect_trial_group == connect_5) { |
204 net::HttpNetworkSession::set_max_sockets_per_group(5); | 208 net::HttpNetworkSession::set_max_sockets_per_group(5); |
205 } else if (connect_trial_group == connect_6) { | 209 } else if (connect_trial_group == connect_6) { |
206 // This (6) is the current default value. | |
207 net::HttpNetworkSession::set_max_sockets_per_group(6); | 210 net::HttpNetworkSession::set_max_sockets_per_group(6); |
208 } else if (connect_trial_group == connect_7) { | 211 } else if (connect_trial_group == connect_7) { |
209 net::HttpNetworkSession::set_max_sockets_per_group(7); | 212 net::HttpNetworkSession::set_max_sockets_per_group(7); |
210 } else if (connect_trial_group == connect_8) { | 213 } else if (connect_trial_group == connect_8) { |
211 net::HttpNetworkSession::set_max_sockets_per_group(8); | 214 net::HttpNetworkSession::set_max_sockets_per_group(8); |
212 } else if (connect_trial_group == connect_9) { | 215 } else if (connect_trial_group == connect_9) { |
213 net::HttpNetworkSession::set_max_sockets_per_group(9); | 216 net::HttpNetworkSession::set_max_sockets_per_group(9); |
214 } else { | 217 } else { |
215 NOTREACHED(); | 218 NOTREACHED(); |
216 } | 219 } |
217 } | 220 } |
218 | 221 |
219 // A/B test for determining a value for unused socket timeout. Currently the | 222 // A/B test for determining a value for unused socket timeout. Currently the |
220 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 223 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
221 // to take advantage of idle sockets. Setting it to too high could possibly | 224 // to take advantage of idle sockets. Setting it to too high could possibly |
222 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST | 225 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST |
223 // packet and possibly another RTT to re-establish the connection. | 226 // packet and possibly another RTT to re-establish the connection. |
224 void BrowserMainParts::SocketTimeoutFieldTrial() { | 227 void BrowserMainParts::SocketTimeoutFieldTrial() { |
225 const FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 228 const FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
226 // 25% probability | 229 // 25% probability |
227 const FieldTrial::Probability kSocketTimeoutProbability = 25; | 230 const FieldTrial::Probability kSocketTimeoutProbability = 25; |
228 | 231 |
229 scoped_refptr<FieldTrial> socket_timeout_trial = | 232 scoped_refptr<FieldTrial> socket_timeout_trial = |
230 new FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); | 233 new FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); |
231 | 234 |
232 const int socket_timeout_5 = | 235 const int socket_timeout_5 = |
233 socket_timeout_trial->AppendGroup("_idle_timeout_5", | 236 socket_timeout_trial->AppendGroup("_idle_timeout_5", |
234 kSocketTimeoutProbability); | 237 kSocketTimeoutProbability); |
235 const int socket_timeout_10 = | |
236 socket_timeout_trial->AppendGroup("_idle_timeout_10", | |
237 kSocketTimeoutProbability); | |
238 const int socket_timeout_20 = | 238 const int socket_timeout_20 = |
239 socket_timeout_trial->AppendGroup("_idle_timeout_20", | 239 socket_timeout_trial->AppendGroup("_idle_timeout_20", |
240 kSocketTimeoutProbability); | 240 kSocketTimeoutProbability); |
241 const int socket_timeout_60 = | 241 const int socket_timeout_60 = |
242 socket_timeout_trial->AppendGroup("_idle_timeout_60", | 242 socket_timeout_trial->AppendGroup("_idle_timeout_60", |
| 243 kSocketTimeoutProbability); |
| 244 // This (10 seconds) is the current default value. Declaring it at the end |
| 245 // allows for assigning the remainder of the probability space to it; which |
| 246 // will make it to modify this value (by changing |kSocketTimeoutProbability|) |
| 247 // down the road if we see the need to, while the remaining groups are |
| 248 // are assigned an equal share of the probability space. |
| 249 const int socket_timeout_10 = |
| 250 socket_timeout_trial->AppendGroup("_idle_timeout_10", |
243 FieldTrial::kAllRemainingProbability); | 251 FieldTrial::kAllRemainingProbability); |
244 | 252 |
245 const int idle_to_trial_group = socket_timeout_trial->group(); | 253 const int idle_to_trial_group = socket_timeout_trial->group(); |
246 | 254 |
247 if (idle_to_trial_group == socket_timeout_5) { | 255 if (idle_to_trial_group == socket_timeout_5) { |
248 net::ClientSocketPool::set_unused_idle_socket_timeout(5); | 256 net::ClientSocketPool::set_unused_idle_socket_timeout(5); |
249 } else if (idle_to_trial_group == socket_timeout_10) { | 257 } else if (idle_to_trial_group == socket_timeout_10) { |
250 // This (10 seconds) is the current default value. | |
251 net::ClientSocketPool::set_unused_idle_socket_timeout(10); | 258 net::ClientSocketPool::set_unused_idle_socket_timeout(10); |
252 } else if (idle_to_trial_group == socket_timeout_20) { | 259 } else if (idle_to_trial_group == socket_timeout_20) { |
253 net::ClientSocketPool::set_unused_idle_socket_timeout(20); | 260 net::ClientSocketPool::set_unused_idle_socket_timeout(20); |
254 } else if (idle_to_trial_group == socket_timeout_60) { | 261 } else if (idle_to_trial_group == socket_timeout_60) { |
255 net::ClientSocketPool::set_unused_idle_socket_timeout(60); | 262 net::ClientSocketPool::set_unused_idle_socket_timeout(60); |
256 } else { | 263 } else { |
257 NOTREACHED(); | 264 NOTREACHED(); |
258 } | 265 } |
259 } | 266 } |
260 | 267 |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1283 |
1277 metrics->Stop(); | 1284 metrics->Stop(); |
1278 | 1285 |
1279 // browser_shutdown takes care of deleting browser_process, so we need to | 1286 // browser_shutdown takes care of deleting browser_process, so we need to |
1280 // release it. | 1287 // release it. |
1281 ignore_result(browser_process.release()); | 1288 ignore_result(browser_process.release()); |
1282 browser_shutdown::Shutdown(); | 1289 browser_shutdown::Shutdown(); |
1283 | 1290 |
1284 return result_code; | 1291 return result_code; |
1285 } | 1292 } |
OLD | NEW |