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 8a8e49a328761497d09ba392e1892b4097691df6..f571c1115d4fc44abd8be48fa08124a77fe8580e 100644 |
--- a/net/http/http_server_properties_impl.cc |
+++ b/net/http/http_server_properties_impl.cc |
@@ -24,6 +24,7 @@ HttpServerPropertiesImpl::HttpServerPropertiesImpl() |
: spdy_servers_map_(SpdyServerHostPortMap::NO_AUTO_EVICT), |
alternate_protocol_map_(AlternateProtocolMap::NO_AUTO_EVICT), |
spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT), |
+ server_network_stats_map_(ServerNetworkStatsMap::NO_AUTO_EVICT), |
alternate_protocol_probability_threshold_(1), |
weak_ptr_factory_(this) { |
canonical_suffixes_.push_back(".c.youtube.com"); |
@@ -109,6 +110,15 @@ void HttpServerPropertiesImpl::InitializeSupportsQuic( |
} |
} |
+void HttpServerPropertiesImpl::InitializeServerNetworkStats( |
+ ServerNetworkStatsMap* server_network_stats_map) { |
+ 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); |
+ } |
+} |
+ |
void HttpServerPropertiesImpl::GetSpdyServerList( |
base::ListValue* spdy_server_list, |
size_t max_size) const { |
@@ -155,10 +165,11 @@ void HttpServerPropertiesImpl::Clear() { |
canonical_host_to_origin_map_.clear(); |
spdy_settings_map_.Clear(); |
supports_quic_map_.clear(); |
+ server_network_stats_map_.Clear(); |
} |
bool HttpServerPropertiesImpl::SupportsSpdy( |
- const net::HostPortPair& host_port_pair) { |
+ const HostPortPair& host_port_pair) { |
DCHECK(CalledOnValidThread()); |
if (host_port_pair.host().empty()) |
return false; |
@@ -171,7 +182,7 @@ bool HttpServerPropertiesImpl::SupportsSpdy( |
} |
void HttpServerPropertiesImpl::SetSupportsSpdy( |
- const net::HostPortPair& host_port_pair, |
+ const HostPortPair& host_port_pair, |
bool support_spdy) { |
DCHECK(CalledOnValidThread()); |
if (host_port_pair.host().empty()) |
@@ -412,28 +423,31 @@ void HttpServerPropertiesImpl::SetSupportsQuic( |
supports_quic_map_.insert(std::make_pair(host_port_pair, supports_quic)); |
} |
-const SupportsQuicMap& |
-HttpServerPropertiesImpl::supports_quic_map() const { |
+const SupportsQuicMap& HttpServerPropertiesImpl::supports_quic_map() const { |
return supports_quic_map_; |
} |
void HttpServerPropertiesImpl::SetServerNetworkStats( |
const HostPortPair& host_port_pair, |
- NetworkStats stats) { |
- server_network_stats_map_[host_port_pair] = stats; |
+ ServerNetworkStats stats) { |
+ server_network_stats_map_.Put(host_port_pair, stats); |
} |
-const HttpServerProperties::NetworkStats* |
-HttpServerPropertiesImpl::GetServerNetworkStats( |
- const HostPortPair& host_port_pair) const { |
- ServerNetworkStatsMap::const_iterator it = |
- server_network_stats_map_.find(host_port_pair); |
+const ServerNetworkStats* HttpServerPropertiesImpl::GetServerNetworkStats( |
+ const HostPortPair& host_port_pair) { |
+ ServerNetworkStatsMap::iterator it = |
+ server_network_stats_map_.Get(host_port_pair); |
if (it == server_network_stats_map_.end()) { |
return NULL; |
} |
return &it->second; |
} |
+const ServerNetworkStatsMap& |
+HttpServerPropertiesImpl::server_network_stats_map() const { |
+ return server_network_stats_map_; |
+} |
+ |
void HttpServerPropertiesImpl::SetAlternateProtocolProbabilityThreshold( |
double threshold) { |
alternate_protocol_probability_threshold_ = threshold; |