OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_settings_storage.h" | 5 #include "net/spdy/spdy_settings_storage.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 SpdySettingsStorage::SpdySettingsStorage() { | 11 SpdySettingsStorage::SpdySettingsStorage() { |
(...skipping 15 matching lines...) Expand all Loading... |
27 void SpdySettingsStorage::Set(const HostPortPair& host_port_pair, | 27 void SpdySettingsStorage::Set(const HostPortPair& host_port_pair, |
28 const spdy::SpdySettings& settings) { | 28 const spdy::SpdySettings& settings) { |
29 spdy::SpdySettings persistent_settings; | 29 spdy::SpdySettings persistent_settings; |
30 | 30 |
31 // Iterate through the list, and only copy those settings which are marked | 31 // Iterate through the list, and only copy those settings which are marked |
32 // for persistence. | 32 // for persistence. |
33 spdy::SpdySettings::const_iterator it; | 33 spdy::SpdySettings::const_iterator it; |
34 for (it = settings.begin(); it != settings.end(); ++it) { | 34 for (it = settings.begin(); it != settings.end(); ++it) { |
35 spdy::SettingsFlagsAndId id = it->first; | 35 spdy::SettingsFlagsAndId id = it->first; |
36 if (id.flags() & spdy::SETTINGS_FLAG_PLEASE_PERSIST) { | 36 if (id.flags() & spdy::SETTINGS_FLAG_PLEASE_PERSIST) { |
37 id.set_flags(spdy::SETTINGS_FLAG_PERSISTED); | 37 spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PERSISTED, id.id()); |
38 persistent_settings.push_back(std::make_pair(id, it->second)); | 38 persistent_settings.push_back(std::make_pair(new_id, it->second)); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 // If we didn't persist anything, then we are done. | 42 // If we didn't persist anything, then we are done. |
43 if (persistent_settings.empty()) | 43 if (persistent_settings.empty()) |
44 return; | 44 return; |
45 | 45 |
46 settings_map_[host_port_pair] = persistent_settings; | 46 settings_map_[host_port_pair] = persistent_settings; |
47 } | 47 } |
48 | 48 |
49 void SpdySettingsStorage::Clear() { | 49 void SpdySettingsStorage::Clear() { |
50 settings_map_.clear(); | 50 settings_map_.clear(); |
51 } | 51 } |
52 | 52 |
53 } // namespace net | 53 } // namespace net |
54 | 54 |
OLD | NEW |