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

Side by Side Diff: net/spdy/spdy_settings_storage.cc

Issue 10054034: SPDY - replaced SpdySettings (list) with SettingsMap (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_settings_storage.h ('k') | net/spdy/spdy_test_util_spdy2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/spdy/spdy_settings_storage.h"
6
7 #include <utility>
8
9 namespace net {
10
11 SpdySettingsStorage::SpdySettingsStorage() {
12 }
13
14 SpdySettingsStorage::~SpdySettingsStorage() {
15 }
16
17 const SpdySettings& SpdySettingsStorage::Get(
18 const HostPortPair& host_port_pair) const {
19 SettingsMap::const_iterator it = settings_map_.find(host_port_pair);
20 if (it == settings_map_.end()) {
21 CR_DEFINE_STATIC_LOCAL(SpdySettings, kEmpty, ());
22 return kEmpty;
23 }
24 return it->second;
25 }
26
27 void SpdySettingsStorage::Set(const HostPortPair& host_port_pair,
28 const SpdySettings& settings) {
29 SpdySettings persistent_settings;
30
31 // Iterate through the list, and only copy those settings which are marked
32 // for persistence.
33 SpdySettings::const_iterator it;
34 for (it = settings.begin(); it != settings.end(); ++it) {
35 SettingsFlagsAndId id = it->first;
36 if (id.flags() & SETTINGS_FLAG_PLEASE_PERSIST) {
37 SettingsFlagsAndId new_id(SETTINGS_FLAG_PERSISTED, id.id());
38 persistent_settings.push_back(std::make_pair(new_id, it->second));
39 }
40 }
41
42 // If we didn't persist anything, then we are done.
43 if (persistent_settings.empty())
44 return;
45
46 settings_map_[host_port_pair] = persistent_settings;
47 }
48
49 void SpdySettingsStorage::Clear() {
50 settings_map_.clear();
51 }
52
53 } // namespace net
54
OLDNEW
« no previous file with comments | « net/spdy/spdy_settings_storage.h ('k') | net/spdy/spdy_test_util_spdy2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698