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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1531943003: Changes to AlternativeServices initialization to maintain MRU order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_spdy_settings_mru_cache
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..c28d3778f146145823386fca01d1b9a8017134b0 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -56,12 +56,26 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
void HttpServerPropertiesImpl::InitializeAlternativeServiceServers(
AlternativeServiceMap* alternative_service_map) {
+ AlternativeServiceMap new_alternative_service_map(
+ AlternativeServiceMap::NO_AUTO_EVICT);
// Add the entries from persisted data.
for (AlternativeServiceMap::reverse_iterator input_it =
alternative_service_map->rbegin();
input_it != alternative_service_map->rend(); ++input_it) {
DCHECK(!input_it->second.empty());
- alternative_service_map_.Put(input_it->first, input_it->second);
+ new_alternative_service_map.Put(input_it->first, input_it->second);
+ }
+
+ alternative_service_map_.Swap(new_alternative_service_map);
+
+ // Add the entries from the memory cache.
+ for (AlternativeServiceMap::reverse_iterator input_it =
+ new_alternative_service_map.rbegin();
+ input_it != new_alternative_service_map.rend(); ++input_it) {
+ if (alternative_service_map_.Get(input_it->first) ==
+ alternative_service_map_.end()) {
+ alternative_service_map_.Put(input_it->first, input_it->second);
+ }
}
// Attempt to find canonical servers.
« 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