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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browser_main.cc
===================================================================
--- chrome/browser/browser_main.cc (revision 86260)
+++ chrome/browser/browser_main.cc (working copy)
@@ -203,6 +203,8 @@
#include "views/touchui/touch_factory.h"
#endif
+using net::internal::ClientSocketPoolBaseHelper;
+
// BrowserMainParts ------------------------------------------------------------
BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
@@ -490,7 +492,54 @@
net::SSLConfigService::DisableFalseStart();
}
+// If --bytes-read-vs-last-accessed-alpha is not specified, run an A/B test for
+// choosing the warmest socket.
+void BrowserMainParts::WarmConnectionFieldTrial() {
+ const CommandLine& command_line = parsed_command_line();
+ if (command_line.HasSwitch(switches::kBytesReadVsLastAccessedAlpha)) {
+ std::string alpha_str = command_line.GetSwitchValueASCII(
+ switches::kBytesReadVsLastAccessedAlpha);
+ double alpha = 0;
+ base::StringToDouble(alpha_str, &alpha);
+ ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(alpha);
+ return;
+ }
+ const base::FieldTrial::Probability kWarmSocketDivisor = 100;
+ const base::FieldTrial::Probability kWarmSocketProbability = 33; // 1% prob.
+
+ // After January 30, 2013 builds, it will always be in default group.
+ scoped_refptr<base::FieldTrial> warmest_socket_trial(
+ new base::FieldTrial(
+ "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket",
+ 2013, 1, 30));
+
+ // This (1000000) is the current default value. Having this group declared
+ // here makes it straightforward to modify |kWarmSocketProbability| such that
+ // the same probability value will be assigned to all the other groups, while
+ // preserving the remainder of the of probability space to the default value.
+ const int last_accessed_socket = warmest_socket_trial->kDefaultGroupNumber;
+ const int warmest_socket = warmest_socket_trial->AppendGroup(
+ "warmest_socket", kWarmSocketProbability);
+ const int warm_socket = warmest_socket_trial->AppendGroup(
+ "warm_socket", kWarmSocketProbability);
+
+ const int warmest_socket_trial_group = warmest_socket_trial->group();
+
+ if (warmest_socket_trial_group == last_accessed_socket) {
+ ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(1000000);
+ } else if (warmest_socket_trial_group == warmest_socket) {
+ ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(1);
+ } else if (warmest_socket_trial_group == warm_socket) {
+ // 1.83841629 = decay of 20 KB per 5 mins.
+ ClientSocketPoolBaseHelper::set_bytes_read_vs_last_accessed_alpha(
+ 1.83841629);
+ } else {
+ NOTREACHED() << "Invalid bytes_read_vs_last_accessed_alpha";
+ }
+}
+
+
// If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is
// specified, run an A/B test for automatically establishing backup TCP
// connections when a certain timeout value is exceeded.
@@ -611,6 +660,7 @@
SpdyFieldTrial();
ConnectBackupJobsFieldTrial();
SSLFalseStartFieldTrial();
+ WarmConnectionFieldTrial();
}
// -----------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698