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

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: reabse TOT 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
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..e84e4a86460d64b7648c815e5604c73839b634ff 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,26 @@ const QuicServerInfoMap& HttpServerPropertiesImpl::quic_server_info_map()
return quic_server_info_map_;
}
+int HttpServerPropertiesImpl::max_server_configs_stored_in_properties() const {
+ return max_server_configs_stored_in_properties_;
+}
+
+void HttpServerPropertiesImpl::set_max_server_configs_stored_in_properties(
mef 2016/01/15 16:12:32 Should this be SetMaxServerConfigsStoredInProperti
ramant (doing other things) 2016/01/15 18:57:01 Good point. Done.
+ int 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.
+ QuicServerInfoMap temp_map(max_server_configs_stored_in_properties_);
+ for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin();
mef 2016/01/15 16:12:32 Microoptimization: quic_server_info_map_.ShrinkToS
ramant (doing other things) 2016/01/15 18:57:01 +1. Thanks for the above optimization. Done.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698