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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 874603004: Remove HasAlternateProtocol(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor. Created 5 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
« 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 a53e73fded1f969e45a5361f0d7d009d4fd57c87..0b6b9743626b0e0bcf273e4875d347118961e0ed 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -179,10 +179,7 @@ bool HttpServerPropertiesImpl::SupportsRequestPriority(
if (spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second)
return true;
- if (!HasAlternateProtocol(host_port_pair))
- return false;
-
- AlternateProtocolInfo info = GetAlternateProtocol(host_port_pair);
+ const AlternateProtocolInfo info = GetAlternateProtocol(host_port_pair);
return info.protocol == QUIC;
}
@@ -228,16 +225,6 @@ void HttpServerPropertiesImpl::MaybeForceHTTP11(const HostPortPair& server,
}
}
-bool HttpServerPropertiesImpl::HasAlternateProtocol(
- const HostPortPair& server) {
- if (g_forced_alternate_protocol)
- return true;
- AlternateProtocolMap::const_iterator it =
- GetAlternateProtocolIterator(server);
- return it != alternate_protocol_map_.end() &&
- it->second.probability >= alternate_protocol_probability_threshold_;
-}
-
std::string HttpServerPropertiesImpl::GetCanonicalSuffix(
const std::string& host) {
// If this host ends with a canonical suffix, then return the canonical
@@ -251,19 +238,19 @@ std::string HttpServerPropertiesImpl::GetCanonicalSuffix(
return std::string();
}
-AlternateProtocolInfo
-HttpServerPropertiesImpl::GetAlternateProtocol(
+AlternateProtocolInfo HttpServerPropertiesImpl::GetAlternateProtocol(
const HostPortPair& server) {
- DCHECK(HasAlternateProtocol(server));
-
AlternateProtocolMap::const_iterator it =
GetAlternateProtocolIterator(server);
- if (it != alternate_protocol_map_.end())
+ if (it != alternate_protocol_map_.end() &&
+ it->second.probability >= alternate_protocol_probability_threshold_)
Ryan Hamilton 2015/02/03 22:29:03 This check is required because it used to be part
Bence 2015/02/03 22:52:37 Yes, that is indeed the case.
return it->second;
- // We must be forcing an alternate.
- DCHECK(g_forced_alternate_protocol);
- return *g_forced_alternate_protocol;
+ if (g_forced_alternate_protocol)
+ return *g_forced_alternate_protocol;
+
+ AlternateProtocolInfo uninitialized_alternate_protocol;
+ return uninitialized_alternate_protocol;
}
void HttpServerPropertiesImpl::SetAlternateProtocol(
@@ -322,15 +309,16 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
const HostPortPair& server) {
AlternateProtocolMap::iterator it = alternate_protocol_map_.Get(server);
+ const AlternateProtocolInfo alternate = GetAlternateProtocol(server);
if (it == alternate_protocol_map_.end()) {
- if (!HasAlternateProtocol(server)) {
+ if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) {
LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
return;
}
// This server's alternate protocol information is coming from a canonical
// server. Add an entry in the map for this server explicitly so that
// it can be marked as broken.
- it = alternate_protocol_map_.Put(server, GetAlternateProtocol(server));
+ it = alternate_protocol_map_.Put(server, alternate);
}
it->second.is_broken = true;
int count = ++broken_alternate_protocol_map_[server];
« 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