| 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 4bb544d3303694f3ec96b137fd8e499b49ee0387..96f3a7d1c719edb8913489ded7b7916f890af7bf 100644
|
| --- a/net/http/http_server_properties_impl.cc
|
| +++ b/net/http/http_server_properties_impl.cc
|
| @@ -26,7 +26,6 @@
|
| alternate_protocol_experiment_(
|
| ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT),
|
| spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT),
|
| - alternate_protocol_probability_threshold_(0),
|
| weak_ptr_factory_(this) {
|
| canoncial_suffixes_.push_back(".c.youtube.com");
|
| canoncial_suffixes_.push_back(".googlevideo.com");
|
| @@ -131,15 +130,15 @@
|
| return spdy_server;
|
| }
|
|
|
| -static const AlternateProtocolInfo* g_forced_alternate_protocol = NULL;
|
| +static const PortAlternateProtocolPair* g_forced_alternate_protocol = NULL;
|
|
|
| // static
|
| void HttpServerPropertiesImpl::ForceAlternateProtocol(
|
| - const AlternateProtocolInfo& info) {
|
| + const PortAlternateProtocolPair& pair) {
|
| // Note: we're going to leak this.
|
| if (g_forced_alternate_protocol)
|
| delete g_forced_alternate_protocol;
|
| - g_forced_alternate_protocol = new AlternateProtocolInfo(info);
|
| + g_forced_alternate_protocol = new PortAlternateProtocolPair(pair);
|
| }
|
|
|
| // static
|
| @@ -194,13 +193,9 @@
|
|
|
| bool HttpServerPropertiesImpl::HasAlternateProtocol(
|
| const HostPortPair& server) {
|
| - if (g_forced_alternate_protocol)
|
| + if (alternate_protocol_map_.Get(server) != alternate_protocol_map_.end() ||
|
| + g_forced_alternate_protocol)
|
| return true;
|
| - AlternateProtocolMap::const_iterator it = alternate_protocol_map_.Get(server);
|
| - if (it != alternate_protocol_map_.end() &&
|
| - it->second.probability > alternate_protocol_probability_threshold_) {
|
| - return true;
|
| - }
|
|
|
| return GetCanonicalHost(server) != canonical_host_to_origin_map_.end();
|
| }
|
| @@ -218,7 +213,7 @@
|
| return std::string();
|
| }
|
|
|
| -AlternateProtocolInfo
|
| +PortAlternateProtocolPair
|
| HttpServerPropertiesImpl::GetAlternateProtocol(
|
| const HostPortPair& server) {
|
| DCHECK(HasAlternateProtocol(server));
|
| @@ -241,18 +236,17 @@
|
| void HttpServerPropertiesImpl::SetAlternateProtocol(
|
| const HostPortPair& server,
|
| uint16 alternate_port,
|
| - AlternateProtocol alternate_protocol,
|
| - double alternate_probability) {
|
| + AlternateProtocol alternate_protocol) {
|
| if (alternate_protocol == ALTERNATE_PROTOCOL_BROKEN) {
|
| LOG(DFATAL) << "Call SetBrokenAlternateProtocol() instead.";
|
| return;
|
| }
|
|
|
| - AlternateProtocolInfo alternate(alternate_port,
|
| - alternate_protocol,
|
| - alternate_probability);
|
| + PortAlternateProtocolPair alternate;
|
| + alternate.port = alternate_port;
|
| + alternate.protocol = alternate_protocol;
|
| if (HasAlternateProtocol(server)) {
|
| - const AlternateProtocolInfo existing_alternate =
|
| + const PortAlternateProtocolPair existing_alternate =
|
| GetAlternateProtocol(server);
|
|
|
| if (existing_alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) {
|
| @@ -266,10 +260,8 @@
|
| << server.ToString()
|
| << " from [Port: " << existing_alternate.port
|
| << ", Protocol: " << existing_alternate.protocol
|
| - << ", Probability: " << existing_alternate.probability
|
| << "] to [Port: " << alternate_port
|
| << ", Protocol: " << alternate_protocol
|
| - << ", Probability: " << alternate_probability
|
| << "].";
|
| }
|
| } else {
|
| @@ -300,9 +292,8 @@
|
| if (it != alternate_protocol_map_.end()) {
|
| it->second.protocol = ALTERNATE_PROTOCOL_BROKEN;
|
| } else {
|
| - AlternateProtocolInfo alternate(server.port(),
|
| - ALTERNATE_PROTOCOL_BROKEN,
|
| - 1);
|
| + PortAlternateProtocolPair alternate;
|
| + alternate.protocol = ALTERNATE_PROTOCOL_BROKEN;
|
| alternate_protocol_map_.Put(server, alternate);
|
| }
|
| int count = ++broken_alternate_protocol_map_[server];
|
| @@ -423,11 +414,6 @@
|
| return &it->second;
|
| }
|
|
|
| -void HttpServerPropertiesImpl::SetAlternateProtocolProbabilityThreshold(
|
| - double threshold) {
|
| - alternate_protocol_probability_threshold_ = threshold;
|
| -}
|
| -
|
| HttpServerPropertiesImpl::CanonicalHostMap::const_iterator
|
| HttpServerPropertiesImpl::GetCanonicalHost(HostPortPair server) const {
|
| for (size_t i = 0; i < canoncial_suffixes_.size(); ++i) {
|
|
|