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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1572753003: QUIC - Allow cronet apps to specify how many server configs are to be (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments in Patch set 4 Created 4 years, 11 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
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | 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 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;
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698