| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // This is an A/B test for the maximum number of persistent connections per | 224 // This is an A/B test for the maximum number of persistent connections per |
| 225 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 225 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
| 226 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 226 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
| 227 // run faster) uses 8. We would like to see how much of an effect this value has | 227 // run faster) uses 8. We would like to see how much of an effect this value has |
| 228 // on browsing. Too large a value might cause us to run into SYN flood detection | 228 // on browsing. Too large a value might cause us to run into SYN flood detection |
| 229 // mechanisms. | 229 // mechanisms. |
| 230 void BrowserMainParts::ConnectionFieldTrial() { | 230 void BrowserMainParts::ConnectionFieldTrial() { |
| 231 const base::FieldTrial::Probability kConnectDivisor = 100; | 231 const base::FieldTrial::Probability kConnectDivisor = 100; |
| 232 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | 232 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. |
| 233 | 233 |
| 234 // After June 30, 2011 builds, it will always be in defaut group. |
| 234 scoped_refptr<base::FieldTrial> connect_trial( | 235 scoped_refptr<base::FieldTrial> connect_trial( |
| 235 new base::FieldTrial("ConnCountImpact", kConnectDivisor)); | 236 new base::FieldTrial("ConnCountImpact", kConnectDivisor, |
| 237 "conn_count_6", 2011, 6, 30)); |
| 238 |
| 239 // This (6) is the current default value. Having this group declared here |
| 240 // makes it straightforward to modify |kConnectProbability| such that the same |
| 241 // probability value will be assigned to all the other groups, while |
| 242 // preserving the remainder of the of probability space to the default value. |
| 243 const int connect_6 = connect_trial->kDefaultGroupNumber; |
| 236 | 244 |
| 237 const int connect_5 = connect_trial->AppendGroup("conn_count_5", | 245 const int connect_5 = connect_trial->AppendGroup("conn_count_5", |
| 238 kConnectProbability); | 246 kConnectProbability); |
| 239 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | 247 const int connect_7 = connect_trial->AppendGroup("conn_count_7", |
| 240 kConnectProbability); | 248 kConnectProbability); |
| 241 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | 249 const int connect_8 = connect_trial->AppendGroup("conn_count_8", |
| 242 kConnectProbability); | 250 kConnectProbability); |
| 243 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | 251 const int connect_9 = connect_trial->AppendGroup("conn_count_9", |
| 244 kConnectProbability); | 252 kConnectProbability); |
| 245 // This (6) is the current default value. Having this group declared here | |
| 246 // makes it straightforward to modify |kConnectProbability| such that the same | |
| 247 // probability value will be assigned to all the other groups, while | |
| 248 // preserving the remainder of the of probability space to the default value. | |
| 249 const int connect_6 = connect_trial->AppendGroup("conn_count_6", | |
| 250 base::FieldTrial::kAllRemainingProbability); | |
| 251 | 253 |
| 252 const int connect_trial_group = connect_trial->group(); | 254 const int connect_trial_group = connect_trial->group(); |
| 253 | 255 |
| 254 if (connect_trial_group == connect_5) { | 256 if (connect_trial_group == connect_5) { |
| 255 net::ClientSocketPoolManager::set_max_sockets_per_group(5); | 257 net::ClientSocketPoolManager::set_max_sockets_per_group(5); |
| 256 } else if (connect_trial_group == connect_6) { | 258 } else if (connect_trial_group == connect_6) { |
| 257 net::ClientSocketPoolManager::set_max_sockets_per_group(6); | 259 net::ClientSocketPoolManager::set_max_sockets_per_group(6); |
| 258 } else if (connect_trial_group == connect_7) { | 260 } else if (connect_trial_group == connect_7) { |
| 259 net::ClientSocketPoolManager::set_max_sockets_per_group(7); | 261 net::ClientSocketPoolManager::set_max_sockets_per_group(7); |
| 260 } else if (connect_trial_group == connect_8) { | 262 } else if (connect_trial_group == connect_8) { |
| 261 net::ClientSocketPoolManager::set_max_sockets_per_group(8); | 263 net::ClientSocketPoolManager::set_max_sockets_per_group(8); |
| 262 } else if (connect_trial_group == connect_9) { | 264 } else if (connect_trial_group == connect_9) { |
| 263 net::ClientSocketPoolManager::set_max_sockets_per_group(9); | 265 net::ClientSocketPoolManager::set_max_sockets_per_group(9); |
| 264 } else { | 266 } else { |
| 265 NOTREACHED(); | 267 NOTREACHED(); |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 | 270 |
| 269 // A/B test for determining a value for unused socket timeout. Currently the | 271 // A/B test for determining a value for unused socket timeout. Currently the |
| 270 // timeout defaults to 10 seconds. Having this value set too low won't allow us | 272 // timeout defaults to 10 seconds. Having this value set too low won't allow us |
| 271 // to take advantage of idle sockets. Setting it to too high could possibly | 273 // to take advantage of idle sockets. Setting it to too high could possibly |
| 272 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST | 274 // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST |
| 273 // packet and possibly another RTT to re-establish the connection. | 275 // packet and possibly another RTT to re-establish the connection. |
| 274 void BrowserMainParts::SocketTimeoutFieldTrial() { | 276 void BrowserMainParts::SocketTimeoutFieldTrial() { |
| 275 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 277 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
| 276 // 1% probability for all experimental settings. | 278 // 1% probability for all experimental settings. |
| 277 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; | 279 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; |
| 278 | 280 |
| 281 // After June 30, 2011 builds, it will always be in defaut group. |
| 279 scoped_refptr<base::FieldTrial> socket_timeout_trial( | 282 scoped_refptr<base::FieldTrial> socket_timeout_trial( |
| 280 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor)); | 283 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor, |
| 284 "idle_timeout_60", 2011, 6, 30)); |
| 285 const int socket_timeout_60 = socket_timeout_trial->kDefaultGroupNumber; |
| 281 | 286 |
| 282 const int socket_timeout_5 = | 287 const int socket_timeout_5 = |
| 283 socket_timeout_trial->AppendGroup("idle_timeout_5", | 288 socket_timeout_trial->AppendGroup("idle_timeout_5", |
| 284 kSocketTimeoutProbability); | 289 kSocketTimeoutProbability); |
| 285 const int socket_timeout_10 = | 290 const int socket_timeout_10 = |
| 286 socket_timeout_trial->AppendGroup("idle_timeout_10", | 291 socket_timeout_trial->AppendGroup("idle_timeout_10", |
| 287 kSocketTimeoutProbability); | 292 kSocketTimeoutProbability); |
| 288 const int socket_timeout_20 = | 293 const int socket_timeout_20 = |
| 289 socket_timeout_trial->AppendGroup("idle_timeout_20", | 294 socket_timeout_trial->AppendGroup("idle_timeout_20", |
| 290 kSocketTimeoutProbability); | 295 kSocketTimeoutProbability); |
| 291 const int socket_timeout_60 = | |
| 292 socket_timeout_trial->AppendGroup("idle_timeout_60", | |
| 293 base::FieldTrial::kAllRemainingProbability); | |
| 294 | 296 |
| 295 const int idle_to_trial_group = socket_timeout_trial->group(); | 297 const int idle_to_trial_group = socket_timeout_trial->group(); |
| 296 | 298 |
| 297 if (idle_to_trial_group == socket_timeout_5) { | 299 if (idle_to_trial_group == socket_timeout_5) { |
| 298 net::ClientSocketPool::set_unused_idle_socket_timeout(5); | 300 net::ClientSocketPool::set_unused_idle_socket_timeout(5); |
| 299 } else if (idle_to_trial_group == socket_timeout_10) { | 301 } else if (idle_to_trial_group == socket_timeout_10) { |
| 300 net::ClientSocketPool::set_unused_idle_socket_timeout(10); | 302 net::ClientSocketPool::set_unused_idle_socket_timeout(10); |
| 301 } else if (idle_to_trial_group == socket_timeout_20) { | 303 } else if (idle_to_trial_group == socket_timeout_20) { |
| 302 net::ClientSocketPool::set_unused_idle_socket_timeout(20); | 304 net::ClientSocketPool::set_unused_idle_socket_timeout(20); |
| 303 } else if (idle_to_trial_group == socket_timeout_60) { | 305 } else if (idle_to_trial_group == socket_timeout_60) { |
| 304 net::ClientSocketPool::set_unused_idle_socket_timeout(60); | 306 net::ClientSocketPool::set_unused_idle_socket_timeout(60); |
| 305 } else { | 307 } else { |
| 306 NOTREACHED(); | 308 NOTREACHED(); |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 | 311 |
| 310 void BrowserMainParts::ProxyConnectionsFieldTrial() { | 312 void BrowserMainParts::ProxyConnectionsFieldTrial() { |
| 311 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; | 313 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; |
| 312 // 25% probability | 314 // 25% probability |
| 313 const base::FieldTrial::Probability kProxyConnectionProbability = 1; | 315 const base::FieldTrial::Probability kProxyConnectionProbability = 1; |
| 314 | 316 |
| 317 // After June 30, 2011 builds, it will always be in defaut group. |
| 315 scoped_refptr<base::FieldTrial> proxy_connection_trial( | 318 scoped_refptr<base::FieldTrial> proxy_connection_trial( |
| 316 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor)); | 319 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor, |
| 320 "proxy_connections_32", 2011, 6, 30)); |
| 321 |
| 322 // This (32 connections per proxy server) is the current default value. |
| 323 // Declaring it here allows us to easily re-assign the probability space while |
| 324 // maintaining that the default group always has the remainder of the "share", |
| 325 // which allows for cleaner and quicker changes down the line if needed. |
| 326 const int proxy_connections_32 = proxy_connection_trial->kDefaultGroupNumber; |
| 317 | 327 |
| 318 // The number of max sockets per group cannot be greater than the max number | 328 // The number of max sockets per group cannot be greater than the max number |
| 319 // of sockets per proxy server. We tried using 8, and it can easily | 329 // of sockets per proxy server. We tried using 8, and it can easily |
| 320 // lead to total browser stalls. | 330 // lead to total browser stalls. |
| 321 const int proxy_connections_16 = | 331 const int proxy_connections_16 = |
| 322 proxy_connection_trial->AppendGroup("proxy_connections_16", | 332 proxy_connection_trial->AppendGroup("proxy_connections_16", |
| 323 kProxyConnectionProbability); | 333 kProxyConnectionProbability); |
| 324 const int proxy_connections_64 = | 334 const int proxy_connections_64 = |
| 325 proxy_connection_trial->AppendGroup("proxy_connections_64", | 335 proxy_connection_trial->AppendGroup("proxy_connections_64", |
| 326 kProxyConnectionProbability); | 336 kProxyConnectionProbability); |
| 327 | 337 |
| 328 // This (32 connections per proxy server) is the current default value. | |
| 329 // Declaring it here allows us to easily re-assign the probability space while | |
| 330 // maintaining that the default group always has the remainder of the "share", | |
| 331 // which allows for cleaner and quicker changes down the line if needed. | |
| 332 const int proxy_connections_32 = | |
| 333 proxy_connection_trial->AppendGroup("proxy_connections_32", | |
| 334 base::FieldTrial::kAllRemainingProbability); | |
| 335 | |
| 336 const int proxy_connections_trial_group = proxy_connection_trial->group(); | 338 const int proxy_connections_trial_group = proxy_connection_trial->group(); |
| 337 | 339 |
| 338 if (proxy_connections_trial_group == proxy_connections_16) { | 340 if (proxy_connections_trial_group == proxy_connections_16) { |
| 339 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(16); | 341 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(16); |
| 340 } else if (proxy_connections_trial_group == proxy_connections_32) { | 342 } else if (proxy_connections_trial_group == proxy_connections_32) { |
| 341 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(32); | 343 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(32); |
| 342 } else if (proxy_connections_trial_group == proxy_connections_64) { | 344 } else if (proxy_connections_trial_group == proxy_connections_64) { |
| 343 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(64); | 345 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(64); |
| 344 } else { | 346 } else { |
| 345 NOTREACHED(); | 347 NOTREACHED(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 356 void BrowserMainParts::SpdyFieldTrial() { | 358 void BrowserMainParts::SpdyFieldTrial() { |
| 357 bool is_spdy_trial = false; | 359 bool is_spdy_trial = false; |
| 358 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { | 360 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { |
| 359 std::string spdy_mode = | 361 std::string spdy_mode = |
| 360 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); | 362 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); |
| 361 net::HttpNetworkLayer::EnableSpdy(spdy_mode); | 363 net::HttpNetworkLayer::EnableSpdy(spdy_mode); |
| 362 } else { | 364 } else { |
| 363 const base::FieldTrial::Probability kSpdyDivisor = 100; | 365 const base::FieldTrial::Probability kSpdyDivisor = 100; |
| 364 // 10% to preclude SPDY. | 366 // 10% to preclude SPDY. |
| 365 base::FieldTrial::Probability npnhttp_probability = 10; | 367 base::FieldTrial::Probability npnhttp_probability = 10; |
| 368 |
| 369 // After June 30, 2011 builds, it will always be in defaut group. |
| 366 scoped_refptr<base::FieldTrial> trial( | 370 scoped_refptr<base::FieldTrial> trial( |
| 367 new base::FieldTrial("SpdyImpact", kSpdyDivisor)); | 371 new base::FieldTrial("SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2011, |
| 372 6, 30)); |
| 373 |
| 374 // npn with spdy support is the default. |
| 375 int npn_spdy_grp = trial->kDefaultGroupNumber; |
| 376 |
| 368 // npn with only http support, no spdy. | 377 // npn with only http support, no spdy. |
| 369 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); | 378 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); |
| 370 // npn with spdy support. | 379 |
| 371 int npn_spdy_grp = trial->AppendGroup("npn_with_spdy", | |
| 372 base::FieldTrial::kAllRemainingProbability); | |
| 373 int trial_grp = trial->group(); | 380 int trial_grp = trial->group(); |
| 374 if (trial_grp == npn_http_grp) { | 381 if (trial_grp == npn_http_grp) { |
| 375 is_spdy_trial = true; | 382 is_spdy_trial = true; |
| 376 net::HttpNetworkLayer::EnableSpdy("npn-http"); | 383 net::HttpNetworkLayer::EnableSpdy("npn-http"); |
| 377 } else if (trial_grp == npn_spdy_grp) { | 384 } else if (trial_grp == npn_spdy_grp) { |
| 378 is_spdy_trial = true; | 385 is_spdy_trial = true; |
| 379 net::HttpNetworkLayer::EnableSpdy("npn"); | 386 net::HttpNetworkLayer::EnableSpdy("npn"); |
| 380 } else { | 387 } else { |
| 381 CHECK(!is_spdy_trial); | 388 CHECK(!is_spdy_trial); |
| 382 } | 389 } |
| 383 } | 390 } |
| 384 | 391 |
| 385 // Setup SPDY CWND Field trial. | 392 // Setup SPDY CWND Field trial. |
| 386 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; | 393 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; |
| 387 const base::FieldTrial::Probability kSpdyCwnd32 = 20; // fixed at 32 | 394 const base::FieldTrial::Probability kSpdyCwnd32 = 20; // fixed at 32 |
| 388 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 | 395 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 |
| 389 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 | 396 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 |
| 390 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 | 397 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 |
| 398 const base::FieldTrial::Probability kSpdyCwndSynamic = 20; |
| 399 |
| 400 // After June 30, 2011 builds, it will always be in defaut group |
| 401 // (cwndDynamic). |
| 391 scoped_refptr<base::FieldTrial> trial( | 402 scoped_refptr<base::FieldTrial> trial( |
| 392 new base::FieldTrial("SpdyCwnd", kSpdyCwndDivisor)); | 403 new base::FieldTrial("SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2011, |
| 404 6, 30)); |
| 405 |
| 393 trial->AppendGroup("cwnd32", kSpdyCwnd32); | 406 trial->AppendGroup("cwnd32", kSpdyCwnd32); |
| 394 trial->AppendGroup("cwnd16", kSpdyCwnd16); | 407 trial->AppendGroup("cwnd16", kSpdyCwnd16); |
| 395 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); | 408 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); |
| 396 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); | 409 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); |
| 397 trial->AppendGroup("cwndDynamic", | 410 trial->AppendGroup("cwndDynamic", kSpdyCwndSynamic); |
| 398 base::FieldTrial::kAllRemainingProbability); | 411 |
| 412 // Finalize the group assignment. |
| 413 trial->group(); |
| 399 | 414 |
| 400 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { | 415 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { |
| 401 int value = 0; | 416 int value = 0; |
| 402 base::StringToInt(parsed_command_line().GetSwitchValueASCII( | 417 base::StringToInt(parsed_command_line().GetSwitchValueASCII( |
| 403 switches::kMaxSpdyConcurrentStreams), | 418 switches::kMaxSpdyConcurrentStreams), |
| 404 &value); | 419 &value); |
| 405 if (value > 0) | 420 if (value > 0) |
| 406 net::SpdySession::set_max_concurrent_streams(value); | 421 net::SpdySession::set_max_concurrent_streams(value); |
| 407 } | 422 } |
| 408 } | 423 } |
| 409 | 424 |
| 410 // If any of --enable-prerender, --enable-content-prefetch or | 425 // If any of --enable-prerender, --enable-content-prefetch or |
| 411 // --disable-content-prefetch are set, use those to determine if | 426 // --disable-content-prefetch are set, use those to determine if |
| 412 // prefetch is enabled. Otherwise, randomly assign users to an A/B test for | 427 // prefetch is enabled. Otherwise, randomly assign users to an A/B test for |
| 413 // prefetching. | 428 // prefetching. |
| 414 void BrowserMainParts::PrefetchFieldTrial() { | 429 void BrowserMainParts::PrefetchFieldTrial() { |
| 415 if (parsed_command_line().HasSwitch(switches::kEnableContentPrefetch) || | 430 if (parsed_command_line().HasSwitch(switches::kEnableContentPrefetch) || |
| 416 parsed_command_line().HasSwitch(switches::kEnablePagePrerender)) | 431 parsed_command_line().HasSwitch(switches::kEnablePagePrerender)) |
| 417 ResourceDispatcherHost::set_is_prefetch_enabled(true); | 432 ResourceDispatcherHost::set_is_prefetch_enabled(true); |
| 418 else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { | 433 else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { |
| 419 ResourceDispatcherHost::set_is_prefetch_enabled(false); | 434 ResourceDispatcherHost::set_is_prefetch_enabled(false); |
| 420 } else { | 435 } else { |
| 421 const base::FieldTrial::Probability kPrefetchDivisor = 1000; | 436 const base::FieldTrial::Probability kPrefetchDivisor = 1000; |
| 422 const base::FieldTrial::Probability no_prefetch_probability = 500; | 437 const base::FieldTrial::Probability no_prefetch_probability = 500; |
| 438 // After June 30, 2011 builds, it will always be in defaut group. |
| 423 scoped_refptr<base::FieldTrial> trial( | 439 scoped_refptr<base::FieldTrial> trial( |
| 424 new base::FieldTrial("Prefetch", kPrefetchDivisor)); | 440 new base::FieldTrial("Prefetch", kPrefetchDivisor, |
| 441 "ContentPrefetchEnabled", 2011, 6, 30)); |
| 442 const int yes_prefetch_grp = trial->kDefaultGroupNumber; |
| 425 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); | 443 trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); |
| 426 const int yes_prefetch_grp = | |
| 427 trial->AppendGroup("ContentPrefetchEnabled", | |
| 428 base::FieldTrial::kAllRemainingProbability); | |
| 429 const int trial_grp = trial->group(); | 444 const int trial_grp = trial->group(); |
| 430 ResourceDispatcherHost::set_is_prefetch_enabled( | 445 ResourceDispatcherHost::set_is_prefetch_enabled( |
| 431 trial_grp == yes_prefetch_grp); | 446 trial_grp == yes_prefetch_grp); |
| 432 } | 447 } |
| 433 } | 448 } |
| 434 | 449 |
| 435 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is | 450 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is |
| 436 // specified, run an A/B test for automatically establishing backup TCP | 451 // specified, run an A/B test for automatically establishing backup TCP |
| 437 // connections when a certain timeout value is exceeded. | 452 // connections when a certain timeout value is exceeded. |
| 438 void BrowserMainParts::ConnectBackupJobsFieldTrial() { | 453 void BrowserMainParts::ConnectBackupJobsFieldTrial() { |
| 439 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { | 454 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { |
| 440 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 455 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 441 true); | 456 true); |
| 442 } else if (parsed_command_line().HasSwitch( | 457 } else if (parsed_command_line().HasSwitch( |
| 443 switches::kDisableConnectBackupJobs)) { | 458 switches::kDisableConnectBackupJobs)) { |
| 444 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 459 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 445 false); | 460 false); |
| 446 } else { | 461 } else { |
| 447 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; | 462 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; |
| 448 // 1% probability. | 463 // 1% probability. |
| 449 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; | 464 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; |
| 465 // After June 30, 2011 builds, it will always be in defaut group. |
| 450 scoped_refptr<base::FieldTrial> trial( | 466 scoped_refptr<base::FieldTrial> trial( |
| 451 new base::FieldTrial("ConnnectBackupJobs", | 467 new base::FieldTrial("ConnnectBackupJobs", |
| 452 kConnectBackupJobsDivisor)); | 468 kConnectBackupJobsDivisor, "ConnectBackupJobsEnabled", 2011, 6, |
| 469 30)); |
| 470 const int connect_backup_jobs_enabled = trial->kDefaultGroupNumber; |
| 453 trial->AppendGroup("ConnectBackupJobsDisabled", | 471 trial->AppendGroup("ConnectBackupJobsDisabled", |
| 454 kConnectBackupJobsProbability); | 472 kConnectBackupJobsProbability); |
| 455 const int connect_backup_jobs_enabled = | |
| 456 trial->AppendGroup("ConnectBackupJobsEnabled", | |
| 457 base::FieldTrial::kAllRemainingProbability); | |
| 458 const int trial_group = trial->group(); | 473 const int trial_group = trial->group(); |
| 459 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 474 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 460 trial_group == connect_backup_jobs_enabled); | 475 trial_group == connect_backup_jobs_enabled); |
| 461 } | 476 } |
| 462 } | 477 } |
| 463 | 478 |
| 464 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- | 479 // BrowserMainParts: |MainMessageLoopStart()| and related ---------------------- |
| 465 | 480 |
| 466 void BrowserMainParts::MainMessageLoopStart() { | 481 void BrowserMainParts::MainMessageLoopStart() { |
| 467 PreMainMessageLoopStart(); | 482 PreMainMessageLoopStart(); |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 | 1539 |
| 1525 // Do initialize the plug-in service (and related preferences). | 1540 // Do initialize the plug-in service (and related preferences). |
| 1526 PluginService::InitGlobalInstance(profile); | 1541 PluginService::InitGlobalInstance(profile); |
| 1527 | 1542 |
| 1528 // Prepare for memory caching of SDCH dictionaries. | 1543 // Prepare for memory caching of SDCH dictionaries. |
| 1529 // Perform A/B test to measure global impact of SDCH support. | 1544 // Perform A/B test to measure global impact of SDCH support. |
| 1530 // Set up a field trial to see what disabling SDCH does to latency of page | 1545 // Set up a field trial to see what disabling SDCH does to latency of page |
| 1531 // layout globally. | 1546 // layout globally. |
| 1532 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; | 1547 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; |
| 1533 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. | 1548 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. |
| 1549 // After June 30, 2011 builds, it will always be in defaut group. |
| 1534 scoped_refptr<base::FieldTrial> sdch_trial( | 1550 scoped_refptr<base::FieldTrial> sdch_trial( |
| 1535 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR)); | 1551 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR, "global_enable_sdch", |
| 1552 2011, 6, 30)); |
| 1553 int sdch_enabled = sdch_trial->kDefaultGroupNumber; |
| 1536 | 1554 |
| 1537 // Use default of "" so that all domains are supported. | 1555 // Use default of "" so that all domains are supported. |
| 1538 std::string sdch_supported_domain(""); | 1556 std::string sdch_supported_domain(""); |
| 1539 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { | 1557 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { |
| 1540 sdch_supported_domain = | 1558 sdch_supported_domain = |
| 1541 parsed_command_line.GetSwitchValueASCII(switches::kSdchFilter); | 1559 parsed_command_line.GetSwitchValueASCII(switches::kSdchFilter); |
| 1542 } else { | 1560 } else { |
| 1543 sdch_trial->AppendGroup("global_disable_sdch", | 1561 sdch_trial->AppendGroup("global_disable_sdch", |
| 1544 kSDCH_DISABLE_PROBABILITY); | 1562 kSDCH_DISABLE_PROBABILITY); |
| 1545 int sdch_enabled = sdch_trial->AppendGroup("global_enable_sdch", | |
| 1546 base::FieldTrial::kAllRemainingProbability); | |
| 1547 if (sdch_enabled != sdch_trial->group()) | 1563 if (sdch_enabled != sdch_trial->group()) |
| 1548 sdch_supported_domain = "never_enabled_sdch_for_any_domain"; | 1564 sdch_supported_domain = "never_enabled_sdch_for_any_domain"; |
| 1549 } | 1565 } |
| 1550 | 1566 |
| 1551 SdchManager sdch_manager; // Singleton database. | 1567 SdchManager sdch_manager; // Singleton database. |
| 1552 sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher); | 1568 sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher); |
| 1553 sdch_manager.EnableSdchSupport(sdch_supported_domain); | 1569 sdch_manager.EnableSdchSupport(sdch_supported_domain); |
| 1554 | 1570 |
| 1555 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); | 1571 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); |
| 1556 InstallJankometer(parsed_command_line); | 1572 InstallJankometer(parsed_command_line); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 #if defined(OS_CHROMEOS) | 1751 #if defined(OS_CHROMEOS) |
| 1736 // To be precise, logout (browser shutdown) is not yet done, but the | 1752 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1737 // remaining work is negligible, hence we say LogoutDone here. | 1753 // remaining work is negligible, hence we say LogoutDone here. |
| 1738 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1754 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1739 false); | 1755 false); |
| 1740 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1756 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1741 #endif | 1757 #endif |
| 1742 TRACE_EVENT_END("BrowserMain", 0, 0); | 1758 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1743 return result_code; | 1759 return result_code; |
| 1744 } | 1760 } |
| OLD | NEW |