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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1860343002: SHP 1: Change SupportsSpdy dict to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 a0a6bfe644f35fbde0ac8fb00d0c1a98d830f307..a7a53bc55b6b2306d0fe183cf2abd1f0f79bfdb2 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -28,7 +28,7 @@ const uint64_t kBrokenAlternativeProtocolDelaySecs = 300;
} // namespace
HttpServerPropertiesImpl::HttpServerPropertiesImpl()
- : spdy_servers_map_(SpdyServerHostPortMap::NO_AUTO_EVICT),
+ : spdy_servers_map_(SpdyServerSchemeHostPortMap::NO_AUTO_EVICT),
alternative_service_map_(AlternativeServiceMap::NO_AUTO_EVICT),
spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT),
server_network_stats_map_(ServerNetworkStatsMap::NO_AUTO_EVICT),
@@ -51,7 +51,8 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
return;
// Add the entries from persisted data.
- SpdyServerHostPortMap spdy_servers_map(SpdyServerHostPortMap::NO_AUTO_EVICT);
+ SpdyServerSchemeHostPortMap spdy_servers_map(
+ SpdyServerSchemeHostPortMap::NO_AUTO_EVICT);
for (std::vector<std::string>::reverse_iterator it = spdy_servers->rbegin();
it != spdy_servers->rend(); ++it) {
spdy_servers_map.Put(*it, support_spdy);
@@ -61,7 +62,8 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
spdy_servers_map_.Swap(spdy_servers_map);
// Add the entries from the memory cache.
- for (SpdyServerHostPortMap::reverse_iterator it = spdy_servers_map.rbegin();
+ for (SpdyServerSchemeHostPortMap::reverse_iterator it =
+ spdy_servers_map.rbegin();
it != spdy_servers_map.rend(); ++it) {
// Add the entry if it is not in the cache, otherwise move it to the front
// of recency list.
@@ -207,12 +209,14 @@ void HttpServerPropertiesImpl::GetSpdyServerList(
DCHECK(spdy_server_list);
spdy_server_list->Clear();
size_t count = 0;
- // Get the list of servers (host/port) that support SPDY.
- for (SpdyServerHostPortMap::const_iterator it = spdy_servers_map_.begin();
+ // Get the list of servers (scheme/host/port) that support SPDY.
+ for (SpdyServerSchemeHostPortMap::const_iterator it =
+ spdy_servers_map_.begin();
it != spdy_servers_map_.end() && count < max_size; ++it) {
- const std::string spdy_server_host_port = it->first;
+ const std::string spdy_server_scheme_host_port = it->first;
if (it->second) {
- spdy_server_list->Append(new base::StringValue(spdy_server_host_port));
+ spdy_server_list->Append(
+ new base::StringValue(spdy_server_scheme_host_port));
++count;
}
}
@@ -234,12 +238,13 @@ void HttpServerPropertiesImpl::Clear() {
}
bool HttpServerPropertiesImpl::SupportsRequestPriority(
- const HostPortPair& host_port_pair) {
+ const url::SchemeHostPort& server) {
+ HostPortPair host_port_pair = HostPortPair::FromSchemeHostPort(server);
DCHECK(CalledOnValidThread());
- if (host_port_pair.host().empty())
+ if (server.host().empty())
return false;
- if (GetSupportsSpdy(host_port_pair))
+ if (GetSupportsSpdy(server))
return true;
const AlternativeServiceVector alternative_service_vector =
@@ -254,31 +259,32 @@ bool HttpServerPropertiesImpl::SupportsRequestPriority(
}
bool HttpServerPropertiesImpl::GetSupportsSpdy(
- const HostPortPair& host_port_pair) {
+ const url::SchemeHostPort& server) {
DCHECK(CalledOnValidThread());
- if (host_port_pair.host().empty())
+ if (server.host().empty())
return false;
- SpdyServerHostPortMap::iterator spdy_host_port =
- spdy_servers_map_.Get(host_port_pair.ToString());
- return spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second;
+ SpdyServerSchemeHostPortMap::iterator spdy_scheme_host_port =
Ryan Hamilton 2016/04/06 19:16:08 how about spdy_server?
Zhongyi Shi 2016/04/07 00:31:18 Done.
+ spdy_servers_map_.Get(server.ToString());
+ return spdy_scheme_host_port != spdy_servers_map_.end() &&
+ spdy_scheme_host_port->second;
}
void HttpServerPropertiesImpl::SetSupportsSpdy(
- const HostPortPair& host_port_pair,
+ const url::SchemeHostPort& server,
bool support_spdy) {
DCHECK(CalledOnValidThread());
- if (host_port_pair.host().empty())
+ if (server.host().empty())
return;
- SpdyServerHostPortMap::iterator spdy_host_port =
- spdy_servers_map_.Get(host_port_pair.ToString());
- if ((spdy_host_port != spdy_servers_map_.end()) &&
- (spdy_host_port->second == support_spdy)) {
+ SpdyServerSchemeHostPortMap::iterator spdy_scheme_host_port =
+ spdy_servers_map_.Get(server.ToString());
+ if ((spdy_scheme_host_port != spdy_servers_map_.end()) &&
+ (spdy_scheme_host_port->second == support_spdy)) {
return;
}
// Cache the data.
- spdy_servers_map_.Put(host_port_pair.ToString(), support_spdy);
+ spdy_servers_map_.Put(server.ToString(), support_spdy);
}
bool HttpServerPropertiesImpl::RequiresHTTP11(

Powered by Google App Engine
This is Rietveld 408576698