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 89754d241f7ef24ac48f3489c9d948a6193129cb..662aab64b8d23389d74e0f5d5ce202d96fd640b3 100644 |
--- a/net/http/http_server_properties_impl.cc |
+++ b/net/http/http_server_properties_impl.cc |
@@ -33,7 +33,8 @@ HttpServerPropertiesImpl::HttpServerPropertiesImpl() |
spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT), |
server_network_stats_map_(ServerNetworkStatsMap::NO_AUTO_EVICT), |
alternative_service_probability_threshold_(1.0), |
- quic_server_info_map_(kMaxQuicServersToPersist), |
+ quic_server_info_map_(QuicServerInfoMap::NO_AUTO_EVICT), |
+ max_server_configs_stored_in_properties_(kMaxQuicServersToPersist), |
weak_ptr_factory_(this) { |
canonical_suffixes_.push_back(".c.youtube.com"); |
canonical_suffixes_.push_back(".googlevideo.com"); |
@@ -184,7 +185,7 @@ void HttpServerPropertiesImpl::InitializeServerNetworkStats( |
void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( |
QuicServerInfoMap* quic_server_info_map) { |
// Add the entries from persisted data. |
- QuicServerInfoMap temp_map(kMaxQuicServersToPersist); |
+ QuicServerInfoMap temp_map(QuicServerInfoMap::NO_AUTO_EVICT); |
for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map->rbegin(); |
it != quic_server_info_map->rend(); ++it) { |
temp_map.Put(it->first, it->second); |
@@ -676,6 +677,28 @@ const QuicServerInfoMap& HttpServerPropertiesImpl::quic_server_info_map() |
return quic_server_info_map_; |
} |
+size_t HttpServerPropertiesImpl::max_server_configs_stored_in_properties() |
+ const { |
+ return max_server_configs_stored_in_properties_; |
+} |
+ |
+void HttpServerPropertiesImpl::SetMaxServerConfigsStoredInProperties( |
+ size_t max_server_configs_stored_in_properties) { |
+ max_server_configs_stored_in_properties_ = |
+ max_server_configs_stored_in_properties; |
+ |
+ // MRUCache doesn't allow the size of the cache to be changed. Thus create a |
+ // new map with the new size and add current elements and swap the new map. |
+ quic_server_info_map_.ShrinkToSize(max_server_configs_stored_in_properties_); |
+ QuicServerInfoMap temp_map(max_server_configs_stored_in_properties_); |
+ for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin(); |
+ it != quic_server_info_map_.rend(); ++it) { |
+ temp_map.Put(it->first, it->second); |
+ } |
+ |
+ quic_server_info_map_.Swap(temp_map); |
+} |
+ |
void HttpServerPropertiesImpl::SetAlternativeServiceProbabilityThreshold( |
double threshold) { |
alternative_service_probability_threshold_ = threshold; |