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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1523543002: SPDY Servers - Servers that are restored from preferences maintain MRU order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mru_cache_swap
Patch Set: rebase Created 5 years 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
« no previous file with comments | « no previous file | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl.cc
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index 77968ff7d6105a653b6f7746fee0713fe7e9a7ad..9ccf5089c608e7e606afba29fc1f931c8fd6006f 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -47,10 +47,24 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
DCHECK(CalledOnValidThread());
if (!spdy_servers)
return;
+
// Add the entries from persisted data.
+ SpdyServerHostPortMap spdy_servers_map(SpdyServerHostPortMap::NO_AUTO_EVICT);
for (std::vector<std::string>::reverse_iterator it = spdy_servers->rbegin();
it != spdy_servers->rend(); ++it) {
- spdy_servers_map_.Put(*it, support_spdy);
+ spdy_servers_map.Put(*it, support_spdy);
+ }
+
+ // |spdy_servers_map| will have the memory cache.
+ spdy_servers_map_.Swap(spdy_servers_map);
+
+ // Add the entries from the memory cache.
+ for (SpdyServerHostPortMap::reverse_iterator it = spdy_servers_map.rbegin();
+ it != spdy_servers_map.rend(); ++it) {
+ // Add the entry if it is not in the cache, otherwise move it to the front
+ // of recency list.
+ if (spdy_servers_map_.Get(it->first) == spdy_servers_map_.end())
+ spdy_servers_map_.Put(it->first, it->second);
}
}
« no previous file with comments | « no previous file | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698