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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1017453008: Make GetAlternateProtocol return AlternativeService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 5 years, 9 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 baa0edbdf8d2397a2607b09ff80e174cba042ee8..28af6756cff0cf283c4fc448a0f4d14b46e58382 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -178,8 +178,9 @@ bool HttpServerPropertiesImpl::SupportsRequestPriority(
if (spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second)
return true;
- const AlternateProtocolInfo info = GetAlternateProtocol(host_port_pair);
- return info.protocol == QUIC;
+ const AlternativeService alternative_service =
+ GetAlternativeService(host_port_pair);
+ return alternative_service.protocol == QUIC;
}
void HttpServerPropertiesImpl::SetSupportsSpdy(
@@ -237,19 +238,21 @@ std::string HttpServerPropertiesImpl::GetCanonicalSuffix(
return std::string();
}
-AlternateProtocolInfo HttpServerPropertiesImpl::GetAlternateProtocol(
- const HostPortPair& server) {
+AlternativeService HttpServerPropertiesImpl::GetAlternativeService(
+ const HostPortPair& origin) {
AlternateProtocolMap::const_iterator it =
- GetAlternateProtocolIterator(server);
+ GetAlternateProtocolIterator(origin);
if (it != alternate_protocol_map_.end() &&
it->second.probability >= alternate_protocol_probability_threshold_)
- return it->second;
+ return AlternativeService(it->second.protocol, origin.host(),
+ it->second.port);
if (g_forced_alternate_protocol)
- return *g_forced_alternate_protocol;
+ return AlternativeService(g_forced_alternate_protocol->protocol,
+ origin.host(), g_forced_alternate_protocol->port);
- AlternateProtocolInfo uninitialized_alternate_protocol;
- return uninitialized_alternate_protocol;
+ AlternativeService uninitialize_alternative_service;
+ return uninitialize_alternative_service;
}
void HttpServerPropertiesImpl::SetAlternateProtocol(
@@ -307,13 +310,11 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
const HostPortPair& server) {
- const AlternateProtocolInfo alternate = GetAlternateProtocol(server);
- if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
+ const AlternativeService alternative_service = GetAlternativeService(server);
+ if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
return;
}
- const AlternativeService alternative_service(alternate.protocol,
- server.host(), alternate.port);
int count = ++recently_broken_alternative_services_[alternative_service];
base::TimeDelta delay =
base::TimeDelta::FromSeconds(kBrokenAlternateProtocolDelaySecs);
@@ -349,22 +350,18 @@ bool HttpServerPropertiesImpl::IsAlternativeServiceBroken(
bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken(
const HostPortPair& server) {
- const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server);
- if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ const AlternativeService alternative_service = GetAlternativeService(server);
+ if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
return false;
- const AlternativeService alternative_service(
- alternate_protocol.protocol, server.host(), alternate_protocol.port);
return ContainsKey(recently_broken_alternative_services_,
alternative_service);
}
void HttpServerPropertiesImpl::ConfirmAlternateProtocol(
const HostPortPair& server) {
- const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server);
- if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ const AlternativeService alternative_service = GetAlternativeService(server);
+ if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
return;
- const AlternativeService alternative_service(
- alternate_protocol.protocol, server.host(), alternate_protocol.port);
broken_alternative_services_.erase(alternative_service);
recently_broken_alternative_services_.erase(alternative_service);
}

Powered by Google App Engine
This is Rietveld 408576698