summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_settings_storage.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 16:12:03 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 16:12:03 +0000
commit0ac338051b72a1e3717bcf8a54270cfeb50f1d13 (patch)
treee860fd6b2f50fb1b2e96081fae4f6600671bf5fb /net/spdy/spdy_settings_storage.cc
parent7ca5cde25380c8dc47b5ac322e2893df875a4643 (diff)
downloadchromium_src-0ac338051b72a1e3717bcf8a54270cfeb50f1d13.zip
chromium_src-0ac338051b72a1e3717bcf8a54270cfeb50f1d13.tar.gz
chromium_src-0ac338051b72a1e3717bcf8a54270cfeb50f1d13.tar.bz2
Add support for the SPDY session frame.
BUG=34749 TEST=SpdyNetworkTransactionTest.SettingsSaved, SettingsPlayback Review URL: http://codereview.chromium.org/1595013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_settings_storage.cc')
-rw-r--r--net/spdy/spdy_settings_storage.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/net/spdy/spdy_settings_storage.cc b/net/spdy/spdy_settings_storage.cc
new file mode 100644
index 0000000..68d9cc1
--- /dev/null
+++ b/net/spdy/spdy_settings_storage.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/spdy/spdy_settings_storage.h"
+
+#include <utility>
+
+namespace net {
+
+SpdySettingsStorage::SpdySettingsStorage() {
+}
+
+const spdy::SpdySettings& SpdySettingsStorage::Get(
+ const HostPortPair& host_port_pair) const {
+ SettingsMap::const_iterator it = settings_map_.find(host_port_pair);
+ if (it == settings_map_.end()) {
+ static const spdy::SpdySettings kEmpty;
+ return kEmpty;
+ }
+ return it->second;
+}
+
+void SpdySettingsStorage::Set(const HostPortPair& host_port_pair,
+ const spdy::SpdySettings& settings) {
+ spdy::SpdySettings persistent_settings;
+
+ // Iterate through the list, and only copy those settings which are marked
+ // for persistence.
+ spdy::SpdySettings::const_iterator it;
+ for (it = settings.begin(); it != settings.end(); ++it) {
+ spdy::SettingsFlagsAndId id = it->first;
+ if (id.flags() & spdy::SETTINGS_FLAG_PLEASE_PERSIST) {
+ id.set_flags(spdy::SETTINGS_FLAG_PERSISTED);
+ persistent_settings.push_back(std::make_pair(id, it->second));
+ }
+ }
+
+ // If we didn't persist anything, then we are done.
+ if (persistent_settings.empty())
+ return;
+
+ settings_map_[host_port_pair] = persistent_settings;
+}
+
+} // namespace net \ No newline at end of file