Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chrome/browser/browser_main.cc

Issue 6990036: Deciding best connection to schedule requests on based on cwnd and idle time (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #endif 196 #endif
197 197
198 #if defined(TOOLKIT_USES_GTK) 198 #if defined(TOOLKIT_USES_GTK)
199 #include "ui/gfx/gtk_util.h" 199 #include "ui/gfx/gtk_util.h"
200 #endif 200 #endif
201 201
202 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) 202 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2)
203 #include "views/touchui/touch_factory.h" 203 #include "views/touchui/touch_factory.h"
204 #endif 204 #endif
205 205
206 using net::internal::ClientSocketPoolBaseHelper;
207
206 // BrowserMainParts ------------------------------------------------------------ 208 // BrowserMainParts ------------------------------------------------------------
207 209
208 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) 210 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
209 : parameters_(parameters), 211 : parameters_(parameters),
210 parsed_command_line_(parameters.command_line_) { 212 parsed_command_line_(parameters.command_line_) {
211 } 213 }
212 214
213 BrowserMainParts::~BrowserMainParts() { 215 BrowserMainParts::~BrowserMainParts() {
214 } 216 }
215 217
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 "SSLFalseStart", kDivisor, "FalseStart_enabled", 2011, 7, 30)); 485 "SSLFalseStart", kDivisor, "FalseStart_enabled", 2011, 7, 30));
484 486
485 int disabled_group = trial->AppendGroup("FalseStart_disabled", 487 int disabled_group = trial->AppendGroup("FalseStart_disabled",
486 falsestart_probability); 488 falsestart_probability);
487 489
488 int trial_grp = trial->group(); 490 int trial_grp = trial->group();
489 if (trial_grp == disabled_group) 491 if (trial_grp == disabled_group)
490 net::SSLConfigService::DisableFalseStart(); 492 net::SSLConfigService::DisableFalseStart();
491 } 493 }
492 494
495 // If --bytes-read-vs-last-accessed-alpha is not specified, run an A/B test for
496 // choosing the warmest socket.
497 void BrowserMainParts::WarmConnectionFieldTrial() {
498 const CommandLine& command_line = parsed_command_line();
499 if (command_line.HasSwitch(switches::kBytesReadVsLastAccessedAlpha)) {
500 std::string alpha_str = command_line.GetSwitchValueASCII(
501 switches::kBytesReadVsLastAccessedAlpha);
502 double alpha = 0;
503 base::StringToDouble(alpha_str, &alpha);
504 ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(alpha);
505 return;
506 }
507
508 const base::FieldTrial::Probability kWarmSocketDivisor = 100;
509 const base::FieldTrial::Probability kWarmSocketProbability = 33; // 1% prob.
510
511 // After January 30, 2013 builds, it will always be in default group.
512 scoped_refptr<base::FieldTrial> warmest_socket_trial(
513 new base::FieldTrial(
514 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket",
515 2013, 1, 30));
516
517 // This (1000000) is the current default value. Having this group declared
518 // here makes it straightforward to modify |kWarmSocketProbability| such that
519 // the same probability value will be assigned to all the other groups, while
520 // preserving the remainder of the of probability space to the default value.
521 const int last_accessed_socket = warmest_socket_trial->kDefaultGroupNumber;
522 const int warmest_socket = warmest_socket_trial->AppendGroup(
523 "warmest_socket", kWarmSocketProbability);
524 const int warm_socket = warmest_socket_trial->AppendGroup(
525 "warm_socket", kWarmSocketProbability);
526
527 const int warmest_socket_trial_group = warmest_socket_trial->group();
528
529 if (warmest_socket_trial_group == last_accessed_socket) {
530 ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(1000000);
531 } else if (warmest_socket_trial_group == warmest_socket) {
532 ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(1);
533 } else if (warmest_socket_trial_group == warm_socket) {
534 // 1.83841629 = decay of 20 KB per 5 mins.
535 ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(
536 1.83841629);
537 } else {
538 NOTREACHED() << "Invalid bytes_read_vs_last_accessed_alpha";
539 }
540 }
541
493 542
494 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is 543 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is
495 // specified, run an A/B test for automatically establishing backup TCP 544 // specified, run an A/B test for automatically establishing backup TCP
496 // connections when a certain timeout value is exceeded. 545 // connections when a certain timeout value is exceeded.
497 void BrowserMainParts::ConnectBackupJobsFieldTrial() { 546 void BrowserMainParts::ConnectBackupJobsFieldTrial() {
498 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { 547 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) {
499 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( 548 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(
500 true); 549 true);
501 } else if (parsed_command_line().HasSwitch( 550 } else if (parsed_command_line().HasSwitch(
502 switches::kDisableConnectBackupJobs)) { 551 switches::kDisableConnectBackupJobs)) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 653
605 // Note: make sure to call ConnectionFieldTrial() before 654 // Note: make sure to call ConnectionFieldTrial() before
606 // ProxyConnectionsFieldTrial(). 655 // ProxyConnectionsFieldTrial().
607 ConnectionFieldTrial(); 656 ConnectionFieldTrial();
608 SocketTimeoutFieldTrial(); 657 SocketTimeoutFieldTrial();
609 ProxyConnectionsFieldTrial(); 658 ProxyConnectionsFieldTrial();
610 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); 659 prerender::ConfigurePrefetchAndPrerender(parsed_command_line());
611 SpdyFieldTrial(); 660 SpdyFieldTrial();
612 ConnectBackupJobsFieldTrial(); 661 ConnectBackupJobsFieldTrial();
613 SSLFalseStartFieldTrial(); 662 SSLFalseStartFieldTrial();
663 WarmConnectionFieldTrial();
614 } 664 }
615 665
616 // ----------------------------------------------------------------------------- 666 // -----------------------------------------------------------------------------
617 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure 667 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure
618 668
619 namespace { 669 namespace {
620 670
621 // This function provides some ways to test crash and assertion handling 671 // This function provides some ways to test crash and assertion handling
622 // behavior of the program. 672 // behavior of the program.
623 void HandleTestParameters(const CommandLine& command_line) { 673 void HandleTestParameters(const CommandLine& command_line) {
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 #if defined(OS_CHROMEOS) 2001 #if defined(OS_CHROMEOS)
1952 // To be precise, logout (browser shutdown) is not yet done, but the 2002 // To be precise, logout (browser shutdown) is not yet done, but the
1953 // remaining work is negligible, hence we say LogoutDone here. 2003 // remaining work is negligible, hence we say LogoutDone here.
1954 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 2004 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1955 false); 2005 false);
1956 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 2006 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1957 #endif 2007 #endif
1958 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 2008 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
1959 return result_code; 2009 return result_code;
1960 } 2010 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698