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

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

Issue 605563003: QUIC - Code to persist if we had talked QUIC to a server and if so what (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 void HttpServerPropertiesImpl::InitializeSpdySettingsServers( 98 void HttpServerPropertiesImpl::InitializeSpdySettingsServers(
99 SpdySettingsMap* spdy_settings_map) { 99 SpdySettingsMap* spdy_settings_map) {
100 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin(); 100 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin();
101 it != spdy_settings_map->rend(); ++it) { 101 it != spdy_settings_map->rend(); ++it) {
102 spdy_settings_map_.Put(it->first, it->second); 102 spdy_settings_map_.Put(it->first, it->second);
103 } 103 }
104 } 104 }
105 105
106 void HttpServerPropertiesImpl::InitializeSupportsQuic(
107 SupportsQuicMap* supports_quic_map) {
108 for (SupportsQuicMap::reverse_iterator it = supports_quic_map->rbegin();
109 it != supports_quic_map->rend();
110 ++it) {
111 supports_quic_map_.insert(std::make_pair(it->first, it->second));
112 }
113 }
114
106 void HttpServerPropertiesImpl::GetSpdyServerList( 115 void HttpServerPropertiesImpl::GetSpdyServerList(
107 base::ListValue* spdy_server_list, 116 base::ListValue* spdy_server_list,
108 size_t max_size) const { 117 size_t max_size) const {
109 DCHECK(CalledOnValidThread()); 118 DCHECK(CalledOnValidThread());
110 DCHECK(spdy_server_list); 119 DCHECK(spdy_server_list);
111 spdy_server_list->Clear(); 120 spdy_server_list->Clear();
112 size_t count = 0; 121 size_t count = 0;
113 // Get the list of servers (host/port) that support SPDY. 122 // Get the list of servers (host/port) that support SPDY.
114 for (SpdyServerHostPortMap::const_iterator it = spdy_servers_map_.begin(); 123 for (SpdyServerHostPortMap::const_iterator it = spdy_servers_map_.begin();
115 it != spdy_servers_map_.end() && count < max_size; ++it) { 124 it != spdy_servers_map_.end() && count < max_size; ++it) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 base::WeakPtr<HttpServerProperties> HttpServerPropertiesImpl::GetWeakPtr() { 160 base::WeakPtr<HttpServerProperties> HttpServerPropertiesImpl::GetWeakPtr() {
152 return weak_ptr_factory_.GetWeakPtr(); 161 return weak_ptr_factory_.GetWeakPtr();
153 } 162 }
154 163
155 void HttpServerPropertiesImpl::Clear() { 164 void HttpServerPropertiesImpl::Clear() {
156 DCHECK(CalledOnValidThread()); 165 DCHECK(CalledOnValidThread());
157 spdy_servers_map_.Clear(); 166 spdy_servers_map_.Clear();
158 alternate_protocol_map_.Clear(); 167 alternate_protocol_map_.Clear();
159 canonical_host_to_origin_map_.clear(); 168 canonical_host_to_origin_map_.clear();
160 spdy_settings_map_.Clear(); 169 spdy_settings_map_.Clear();
170 supports_quic_map_.clear();
161 } 171 }
162 172
163 bool HttpServerPropertiesImpl::SupportsSpdy( 173 bool HttpServerPropertiesImpl::SupportsSpdy(
164 const net::HostPortPair& host_port_pair) { 174 const net::HostPortPair& host_port_pair) {
165 DCHECK(CalledOnValidThread()); 175 DCHECK(CalledOnValidThread());
166 if (host_port_pair.host().empty()) 176 if (host_port_pair.host().empty())
167 return false; 177 return false;
168 std::string spdy_server = GetFlattenedSpdyServer(host_port_pair); 178 std::string spdy_server = GetFlattenedSpdyServer(host_port_pair);
169 179
170 SpdyServerHostPortMap::iterator spdy_host_port = 180 SpdyServerHostPortMap::iterator spdy_host_port =
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 409
400 void HttpServerPropertiesImpl::ClearAllSpdySettings() { 410 void HttpServerPropertiesImpl::ClearAllSpdySettings() {
401 spdy_settings_map_.Clear(); 411 spdy_settings_map_.Clear();
402 } 412 }
403 413
404 const SpdySettingsMap& 414 const SpdySettingsMap&
405 HttpServerPropertiesImpl::spdy_settings_map() const { 415 HttpServerPropertiesImpl::spdy_settings_map() const {
406 return spdy_settings_map_; 416 return spdy_settings_map_;
407 } 417 }
408 418
419 SupportsQuic HttpServerPropertiesImpl::GetSupportsQuic(
420 const HostPortPair& host_port_pair) const {
421 SupportsQuicMap::const_iterator it = supports_quic_map_.find(host_port_pair);
422 if (it == supports_quic_map_.end()) {
423 CR_DEFINE_STATIC_LOCAL(SupportsQuic, kEmptySupportsQuic, ());
424 return kEmptySupportsQuic;
425 }
426 return it->second;
427 }
428
429 void HttpServerPropertiesImpl::SetSupportsQuic(
430 const HostPortPair& host_port_pair,
431 bool used_quic,
432 const std::string& address) {
433 SupportsQuic supports_quic(used_quic, address);
434 supports_quic_map_.insert(std::make_pair(host_port_pair, supports_quic));
435 }
436
437 const SupportsQuicMap&
438 HttpServerPropertiesImpl::supports_quic_map() const {
439 return supports_quic_map_;
440 }
441
409 void HttpServerPropertiesImpl::SetServerNetworkStats( 442 void HttpServerPropertiesImpl::SetServerNetworkStats(
410 const HostPortPair& host_port_pair, 443 const HostPortPair& host_port_pair,
411 NetworkStats stats) { 444 NetworkStats stats) {
412 server_network_stats_map_[host_port_pair] = stats; 445 server_network_stats_map_[host_port_pair] = stats;
413 } 446 }
414 447
415 const HttpServerProperties::NetworkStats* 448 const HttpServerProperties::NetworkStats*
416 HttpServerPropertiesImpl::GetServerNetworkStats( 449 HttpServerPropertiesImpl::GetServerNetworkStats(
417 const HostPortPair& host_port_pair) const { 450 const HostPortPair& host_port_pair) const {
418 ServerNetworkStatsMap::const_iterator it = 451 ServerNetworkStatsMap::const_iterator it =
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 511 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
479 base::MessageLoop::current()->PostDelayedTask( 512 base::MessageLoop::current()->PostDelayedTask(
480 FROM_HERE, 513 FROM_HERE,
481 base::Bind( 514 base::Bind(
482 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 515 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
483 weak_ptr_factory_.GetWeakPtr()), 516 weak_ptr_factory_.GetWeakPtr()),
484 delay); 517 delay);
485 } 518 }
486 519
487 } // namespace net 520 } // namespace net
OLDNEW
« 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