summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_session.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-11 10:34:43 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-11 10:34:43 +0000
commit1dac1041c1e44027b2393fde89e734d62dfa7bd5 (patch)
tree14a80bd1fe8e937a6d256792f5f52fda3eccd388 /net/spdy/spdy_session.cc
parent5820d2f0458c851b18df616ef3aff80cb4f8dba4 (diff)
downloadchromium_src-1dac1041c1e44027b2393fde89e734d62dfa7bd5.zip
chromium_src-1dac1041c1e44027b2393fde89e734d62dfa7bd5.tar.gz
chromium_src-1dac1041c1e44027b2393fde89e734d62dfa7bd5.tar.bz2
Add some experiments for different policies on cwnd restore.
BUG=none TEST=self Review URL: http://codereview.chromium.org/5687002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session.cc')
-rw-r--r--net/spdy/spdy_session.cc44
1 files changed, 37 insertions, 7 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index b883cc2..c5a4277 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -8,6 +8,7 @@
#include "base/linked_ptr.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/stats_counters.h"
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
@@ -1326,26 +1327,55 @@ void SpdySession::SendWindowUpdate(spdy::SpdyStreamId stream_id,
QueueFrame(window_update_frame.get(), stream->priority(), stream);
}
+// Given a cwnd that we would have sent to the server, modify it based on the
+// field trial policy.
+uint32 ApplyCwndFieldTrialPolicy(int cwnd) {
+ base::FieldTrial* trial = base::FieldTrialList::Find("SpdyCwnd");
+ if (trial->group_name() == "cwnd32")
+ return 32;
+ else if (trial->group_name() == "cwnd16")
+ return 16;
+ else if (trial->group_name() == "cwndMin16")
+ return std::max(cwnd, 16);
+ else if (trial->group_name() == "cwndMin10")
+ return std::max(cwnd, 10);
+ else if (trial->group_name() == "cwndDynamic")
+ return cwnd;
+ NOTREACHED();
+ return cwnd;
+}
+
void SpdySession::SendSettings() {
- const spdy::SpdySettings& settings = spdy_settings_->Get(host_port_pair());
+ // Note: we're copying the settings here, so that we can potentially modify
+ // the settings for the field trial. When removing the field trial, make
+ // this a reference to the const SpdySettings again.
+ spdy::SpdySettings settings = spdy_settings_->Get(host_port_pair());
if (settings.empty())
return;
- HandleSettings(settings);
- // Record Histogram Data
- for (spdy::SpdySettings::const_iterator i = settings.begin(),
+ // Record Histogram Data and Apply the SpdyCwnd FieldTrial if applicable.
+ for (spdy::SpdySettings::iterator i = settings.begin(),
end = settings.end(); i != end; ++i) {
const uint32 id = i->first.id();
const uint32 val = i->second;
switch (id) {
case spdy::SETTINGS_CURRENT_CWND:
- UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent",
- val,
- 1, 200, 100);
+ uint32 cwnd = 0;
+ cwnd = ApplyCwndFieldTrialPolicy(val);
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent",
+ cwnd,
+ 1, 200, 100);
+ if (cwnd != val) {
+ i->second = cwnd;
+ i->first.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST);
+ spdy_settings_->Set(host_port_pair(), settings);
+ }
break;
}
}
+ HandleSettings(settings);
+
net_log_.AddEvent(
NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS,
make_scoped_refptr(new NetLogSpdySettingsParameter(settings)));