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

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: addressing comments 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 88789)
+++ chrome/browser/browser_main.cc (working copy)
@@ -100,6 +100,7 @@
#include "net/base/cookie_monster.h"
#include "net/base/net_module.h"
#include "net/base/network_change_notifier.h"
+#include "net/http/http_basic_stream.h"
#include "net/http/http_network_layer.h"
#include "net/http/http_stream_factory.h"
#include "net/socket/client_socket_pool_base.h"
@@ -207,6 +208,23 @@
#include "views/touchui/touch_factory.h"
#endif
+namespace {
+void SetSocketReusePolicy(int warmest_socket_trial_group,
+ const int socket_policy[],
+ int num_groups) {
+ for (int i = 0; i < num_groups; i++) {
+ if (warmest_socket_trial_group == socket_policy[i]) {
+ net::SetSocketReusePolicy(i);
+ net::HttpBasicStream::SetSocketReusePolicy(i);
willchan no longer on Chromium 2011/06/14 12:01:22 How about you don't call this one and instead add
Gagan 2011/06/14 18:25:02 Done.
+ return;
+ }
+ }
+
+ LOG(ERROR) << "Not a valid socket reuse policy group";
willchan no longer on Chromium 2011/06/14 12:01:22 Either kill the LOG(ERROR) or use LOG(DFATAL) and
Gagan 2011/06/14 18:25:02 Retained only NOTREACHED
+ NOTREACHED() << "Not a valid socket reuse policy group";
+}
+}
+
namespace net {
class NetLog;
} // namespace net
@@ -474,6 +492,46 @@
}
}
+// If --socket-reuse-policy 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::kSocketReusePolicy)) {
+ std::string socket_reuse_policy_str = command_line.GetSwitchValueASCII(
+ switches::kSocketReusePolicy);
+ int policy = -1;
+ base::StringToInt(socket_reuse_policy_str, &policy);
+
+ const int policy_list[] = { 0, 1, 2 };
+ LOG(ERROR) << "Setting socket_reuse_policy = " << policy;
willchan no longer on Chromium 2011/06/14 12:01:22 Please get rid of this LOG.
Gagan 2011/06/14 18:25:02 Changed to DLOG(INFO)
+ SetSocketReusePolicy(policy, policy_list, arraysize(policy_list));
+ return;
+ }
+
+ const base::FieldTrial::Probability kWarmSocketDivisor = 100;
+ const base::FieldTrial::Probability kWarmSocketProbability = 33;
+
+ // 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));
+
+ // Default value is USE_LAST_ACCESSED_SOCKET.
+ 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();
+
+ const int policy_list[] = { warmest_socket, warm_socket,
+ last_accessed_socket };
willchan no longer on Chromium 2011/06/14 12:01:22 indentation is off, you need one more horizontal w
Gagan 2011/06/14 18:25:02 Done.
+ SetSocketReusePolicy(warmest_socket_trial_group, policy_list,
+ arraysize(policy_list));
willchan no longer on Chromium 2011/06/14 12:01:22 alignment is off
Gagan 2011/06/14 18:25:02 Done.
+}
+
// 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 +669,7 @@
SpdyFieldTrial();
ConnectBackupJobsFieldTrial();
RevocationCheckingDisabledFieldTrial();
+ WarmConnectionFieldTrial();
}
// -----------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698