Index: chrome/browser/browser_main.cc |
=================================================================== |
--- chrome/browser/browser_main.cc (revision 88319) |
+++ 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,9 @@ |
#include "views/touchui/touch_factory.h" |
#endif |
+using net::internal::ClientSocketPoolBaseHelper; |
+using net::HttpBasicStream; |
+ |
namespace net { |
class NetLog; |
} // namespace net |
@@ -474,6 +478,61 @@ |
} |
} |
+// If --bytes-read-vs-last-accessed-decay-coef 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::kTcpSocketEstimatedCwndDecayCoef)) { |
+ std::string alpha_str = command_line.GetSwitchValueASCII( |
+ switches::kTcpSocketEstimatedCwndDecayCoef); |
+ double coef = 0; |
+ base::StringToDouble(alpha_str, &coef); |
+ ClientSocketPoolBaseHelper::set_tcp_socket_estimated_cwnd_decay_coef( |
+ coef); |
+ HttpBasicStream::set_warm_connection_field_trial_group("manual"); |
+ return; |
+ } |
+ |
+ const base::FieldTrial::Probability kWarmSocketDivisor = 100; |
+ const base::FieldTrial::Probability kWarmSocketProbability = 33; // 1% prob. |
Mike Belshe
2011/06/09 16:08:52
The comment is wrong here
Gagan
2011/06/09 19:49:26
Done.
|
+ |
+ // 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. |
Mike Belshe
2011/06/09 16:08:52
I think the comment is wrong here too?
Gagan
2011/06/09 19:49:26
Done.
|
+ 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_tcp_socket_estimated_cwnd_decay_coef( |
Mike Belshe
2011/06/09 16:08:52
This seems like a strange place to set the policy.
Gagan
2011/06/09 19:49:26
Done.
|
+ 1000000); |
+ HttpBasicStream::set_warm_connection_field_trial_group( |
+ "last_accessed_socket"); |
+ } else if (warmest_socket_trial_group == warmest_socket) { |
+ ClientSocketPoolBaseHelper::set_tcp_socket_estimated_cwnd_decay_coef( |
+ 1); |
+ HttpBasicStream::set_warm_connection_field_trial_group( |
+ "warmest_socket"); |
+ } else if (warmest_socket_trial_group == warm_socket) { |
+ // 1.83841629 = decay of 20 KB per 5 mins. |
+ ClientSocketPoolBaseHelper::set_tcp_socket_estimated_cwnd_decay_coef( |
+ 1.83841629); |
+ HttpBasicStream::set_warm_connection_field_trial_group( |
+ "warm_socket"); |
+ } 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. |
@@ -593,6 +652,7 @@ |
prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
SpdyFieldTrial(); |
ConnectBackupJobsFieldTrial(); |
+ WarmConnectionFieldTrial(); |
} |
// ----------------------------------------------------------------------------- |