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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 9802003: SPDY - persist SPDY settings. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_server_properties_impl.cc
===================================================================
--- net/http/http_server_properties_impl.cc (revision 127896)
+++ net/http/http_server_properties_impl.cc (working copy)
@@ -52,7 +52,7 @@
}
void HttpServerPropertiesImpl::InitializeSpdySettingsServers(
- std::map<HostPortPair, spdy::SpdySettings>* spdy_settings_map) {
+ SpdySettingsMap* spdy_settings_map) {
spdy_settings_map_.swap(*spdy_settings_map);
}
@@ -220,58 +220,28 @@
return alternate_protocol_map_;
}
-const spdy::SpdySettings& HttpServerPropertiesImpl::GetSpdySettings(
+const spdy::SettingsMap& HttpServerPropertiesImpl::GetSpdySettings(
const HostPortPair& host_port_pair) const {
- SpdySettingsMap::const_iterator it = spdy_settings_map_.find(host_port_pair);
+ SpdySettingsMap::const_iterator it =
+ spdy_settings_map_.find(host_port_pair);
Ryan Hamilton 2012/03/21 16:24:41 can this all fit on one line? (Looks like it did
ramant (doing other things) 2012/03/23 04:11:25 Done.
if (it == spdy_settings_map_.end()) {
- CR_DEFINE_STATIC_LOCAL(spdy::SpdySettings, kEmptySpdySettings, ());
- return kEmptySpdySettings;
+ CR_DEFINE_STATIC_LOCAL(spdy::SettingsMap, kEmptySettingsMap, ());
+ return kEmptySettingsMap;
}
return it->second;
}
-bool HttpServerPropertiesImpl::SetSpdySettings(
- 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) {
- spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PERSISTED, id.id());
- persistent_settings.push_back(std::make_pair(new_id, it->second));
- }
- }
-
- // If we didn't persist anything, then we are done.
- if (persistent_settings.empty())
- return false;
-
- spdy_settings_map_[host_port_pair] = persistent_settings;
- return true;
-}
-
bool HttpServerPropertiesImpl::SetSpdySetting(
const HostPortPair& host_port_pair,
- const spdy::SpdySetting& setting) {
-
- spdy::SettingsFlagsAndId id = setting.first;
- if (!(id.flags() & spdy::SETTINGS_FLAG_PLEASE_PERSIST))
+ uint32 id,
+ const spdy::SettingsFlagsAndValue& flags_and_value) {
+ if (!(flags_and_value.first & spdy::SETTINGS_FLAG_PLEASE_PERSIST))
return false;
- SpdySettingsMap::const_iterator it = spdy_settings_map_.find(host_port_pair);
- spdy::SpdySettings persistent_settings;
- if (it != spdy_settings_map_.end()) {
- persistent_settings = it->second;
- }
-
- spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PERSISTED, id.id());
- persistent_settings.push_back(std::make_pair(new_id, setting.second));
- spdy_settings_map_[host_port_pair] = persistent_settings;
-
+ spdy::SettingsMap& settings_map = spdy_settings_map_[host_port_pair];
+ spdy::SettingsFlagsAndValue new_flags_and_value(
+ spdy::SETTINGS_FLAG_PERSISTED, flags_and_value.second);
+ settings_map[id] = new_flags_and_value;
Ryan Hamilton 2012/03/21 16:24:41 So much cleaner! Obviously correct, too :>
ramant (doing other things) 2012/03/23 04:11:25 Thanks.
return true;
}

Powered by Google App Engine
This is Rietveld 408576698