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

Side by Side Diff: net/http/http_server_properties_impl.cc

Issue 411423003: Make the default alternate protcol probability threshold 1, not 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 namespace { 17 namespace {
18 18
19 const uint64 kBrokenAlternateProtocolDelaySecs = 300; 19 const uint64 kBrokenAlternateProtocolDelaySecs = 300;
20 20
21 } // namespace 21 } // namespace
22 22
23 HttpServerPropertiesImpl::HttpServerPropertiesImpl() 23 HttpServerPropertiesImpl::HttpServerPropertiesImpl()
24 : spdy_servers_map_(SpdyServerHostPortMap::NO_AUTO_EVICT), 24 : spdy_servers_map_(SpdyServerHostPortMap::NO_AUTO_EVICT),
25 alternate_protocol_map_(AlternateProtocolMap::NO_AUTO_EVICT), 25 alternate_protocol_map_(AlternateProtocolMap::NO_AUTO_EVICT),
26 alternate_protocol_experiment_( 26 alternate_protocol_experiment_(
27 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT), 27 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT),
28 spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT), 28 spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT),
29 alternate_protocol_probability_threshold_(0), 29 alternate_protocol_probability_threshold_(1),
30 weak_ptr_factory_(this) { 30 weak_ptr_factory_(this) {
31 canoncial_suffixes_.push_back(".c.youtube.com"); 31 canoncial_suffixes_.push_back(".c.youtube.com");
32 canoncial_suffixes_.push_back(".googlevideo.com"); 32 canoncial_suffixes_.push_back(".googlevideo.com");
33 canoncial_suffixes_.push_back(".googleusercontent.com"); 33 canoncial_suffixes_.push_back(".googleusercontent.com");
34 } 34 }
35 35
36 HttpServerPropertiesImpl::~HttpServerPropertiesImpl() { 36 HttpServerPropertiesImpl::~HttpServerPropertiesImpl() {
37 } 37 }
38 38
39 void HttpServerPropertiesImpl::InitializeSpdyServers( 39 void HttpServerPropertiesImpl::InitializeSpdyServers(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Cache the data. 191 // Cache the data.
192 spdy_servers_map_.Put(spdy_server, support_spdy); 192 spdy_servers_map_.Put(spdy_server, support_spdy);
193 } 193 }
194 194
195 bool HttpServerPropertiesImpl::HasAlternateProtocol( 195 bool HttpServerPropertiesImpl::HasAlternateProtocol(
196 const HostPortPair& server) { 196 const HostPortPair& server) {
197 if (g_forced_alternate_protocol) 197 if (g_forced_alternate_protocol)
198 return true; 198 return true;
199 AlternateProtocolMap::const_iterator it = alternate_protocol_map_.Get(server); 199 AlternateProtocolMap::const_iterator it = alternate_protocol_map_.Get(server);
200 if (it != alternate_protocol_map_.end() && 200 if (it != alternate_protocol_map_.end() &&
201 it->second.probability > alternate_protocol_probability_threshold_) { 201 it->second.probability >= alternate_protocol_probability_threshold_) {
202 return true; 202 return true;
203 } 203 }
204 204
205 return GetCanonicalHost(server) != canonical_host_to_origin_map_.end(); 205 return GetCanonicalHost(server) != canonical_host_to_origin_map_.end();
206 } 206 }
207 207
208 std::string HttpServerPropertiesImpl::GetCanonicalSuffix( 208 std::string HttpServerPropertiesImpl::GetCanonicalSuffix(
209 const HostPortPair& server) { 209 const HostPortPair& server) {
210 // If this host ends with a canonical suffix, then return the canonical 210 // If this host ends with a canonical suffix, then return the canonical
211 // suffix. 211 // suffix.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 478 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
479 base::MessageLoop::current()->PostDelayedTask( 479 base::MessageLoop::current()->PostDelayedTask(
480 FROM_HERE, 480 FROM_HERE,
481 base::Bind( 481 base::Bind(
482 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 482 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
483 weak_ptr_factory_.GetWeakPtr()), 483 weak_ptr_factory_.GetWeakPtr()),
484 delay); 484 delay);
485 } 485 }
486 486
487 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698