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

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: git sync 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
« 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 b45266b050277694566542b393f3502d5c9c5415..e4c9d85e63f6903886fa7738b10b8749ae76a503 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_(SpdyServersMap::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),
@@ -52,7 +52,7 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
return;
// Add the entries from persisted data.
- SpdyServerHostPortMap spdy_servers_map(SpdyServerHostPortMap::NO_AUTO_EVICT);
+ SpdyServersMap spdy_servers_map(SpdyServersMap::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);
@@ -62,7 +62,7 @@ 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 (SpdyServersMap::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.
@@ -208,12 +208,12 @@ 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 (SpdyServersMap::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 = 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));
++count;
}
}
@@ -235,14 +235,14 @@ void HttpServerPropertiesImpl::Clear() {
}
bool HttpServerPropertiesImpl::SupportsRequestPriority(
- const HostPortPair& host_port_pair) {
+ const url::SchemeHostPort& server) {
+ HostPortPair host_port_pair(server.host(), server.port());
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 =
GetAlternativeServices(host_port_pair);
for (const AlternativeService& alternative_service :
@@ -255,31 +255,31 @@ 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;
+ SpdyServersMap::iterator spdy_server =
+ spdy_servers_map_.Get(server.Serialize());
+ return spdy_server != spdy_servers_map_.end() && spdy_server->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)) {
+ SpdyServersMap::iterator spdy_server =
+ spdy_servers_map_.Get(server.Serialize());
+ if ((spdy_server != spdy_servers_map_.end()) &&
+ (spdy_server->second == support_spdy)) {
return;
}
// Cache the data.
- spdy_servers_map_.Put(host_port_pair.ToString(), support_spdy);
+ spdy_servers_map_.Put(server.Serialize(), support_spdy);
}
bool HttpServerPropertiesImpl::RequiresHTTP11(
« 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