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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1530333004: Changes to ServerNetworkStatsMap initialization to maintain MRU order of (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_alternate_service_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..27aaaa6b4e3c53bef84dcbf257c8e6af385ccd05 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -108,10 +108,25 @@ void HttpServerPropertiesImpl::InitializeSupportsQuic(
void HttpServerPropertiesImpl::InitializeServerNetworkStats(
ServerNetworkStatsMap* server_network_stats_map) {
+ // Add the entries from persisted data.
+ ServerNetworkStatsMap new_server_network_stats_map(
+ ServerNetworkStatsMap::NO_AUTO_EVICT);
for (ServerNetworkStatsMap::reverse_iterator it =
server_network_stats_map->rbegin();
it != server_network_stats_map->rend(); ++it) {
- server_network_stats_map_.Put(it->first, it->second);
+ new_server_network_stats_map.Put(it->first, it->second);
+ }
+
+ server_network_stats_map_.Swap(new_server_network_stats_map);
+
+ // Add the entries from the memory cache.
+ for (ServerNetworkStatsMap::reverse_iterator it =
+ new_server_network_stats_map.rbegin();
+ it != new_server_network_stats_map.rend(); ++it) {
+ if (server_network_stats_map_.Get(it->first) ==
+ server_network_stats_map_.end()) {
+ server_network_stats_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