OLD | NEW |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void HttpServerPropertiesImpl::Clear() { | 161 void HttpServerPropertiesImpl::Clear() { |
162 DCHECK(CalledOnValidThread()); | 162 DCHECK(CalledOnValidThread()); |
163 spdy_servers_map_.Clear(); | 163 spdy_servers_map_.Clear(); |
164 alternate_protocol_map_.Clear(); | 164 alternate_protocol_map_.Clear(); |
165 canonical_host_to_origin_map_.clear(); | 165 canonical_host_to_origin_map_.clear(); |
166 spdy_settings_map_.Clear(); | 166 spdy_settings_map_.Clear(); |
167 supports_quic_map_.clear(); | 167 supports_quic_map_.clear(); |
168 server_network_stats_map_.Clear(); | 168 server_network_stats_map_.Clear(); |
169 } | 169 } |
170 | 170 |
171 bool HttpServerPropertiesImpl::SupportsSpdy( | 171 bool HttpServerPropertiesImpl::SupportsRequestPriority( |
172 const HostPortPair& host_port_pair) { | 172 const HostPortPair& host_port_pair) { |
173 DCHECK(CalledOnValidThread()); | 173 DCHECK(CalledOnValidThread()); |
174 if (host_port_pair.host().empty()) | 174 if (host_port_pair.host().empty()) |
175 return false; | 175 return false; |
176 | 176 |
177 SpdyServerHostPortMap::iterator spdy_host_port = | 177 SpdyServerHostPortMap::iterator spdy_host_port = |
178 spdy_servers_map_.Get(host_port_pair.ToString()); | 178 spdy_servers_map_.Get(host_port_pair.ToString()); |
179 if (spdy_host_port != spdy_servers_map_.end()) | 179 if (spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second) |
180 return spdy_host_port->second; | 180 return true; |
181 return false; | 181 |
| 182 if (!HasAlternateProtocol(host_port_pair)) |
| 183 return false; |
| 184 |
| 185 AlternateProtocolInfo info = GetAlternateProtocol(host_port_pair); |
| 186 return info.protocol == QUIC; |
182 } | 187 } |
183 | 188 |
184 void HttpServerPropertiesImpl::SetSupportsSpdy( | 189 void HttpServerPropertiesImpl::SetSupportsSpdy( |
185 const HostPortPair& host_port_pair, | 190 const HostPortPair& host_port_pair, |
186 bool support_spdy) { | 191 bool support_spdy) { |
187 DCHECK(CalledOnValidThread()); | 192 DCHECK(CalledOnValidThread()); |
188 if (host_port_pair.host().empty()) | 193 if (host_port_pair.host().empty()) |
189 return; | 194 return; |
190 | 195 |
191 SpdyServerHostPortMap::iterator spdy_host_port = | 196 SpdyServerHostPortMap::iterator spdy_host_port = |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 536 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
532 base::MessageLoop::current()->PostDelayedTask( | 537 base::MessageLoop::current()->PostDelayedTask( |
533 FROM_HERE, | 538 FROM_HERE, |
534 base::Bind( | 539 base::Bind( |
535 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 540 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
536 weak_ptr_factory_.GetWeakPtr()), | 541 weak_ptr_factory_.GetWeakPtr()), |
537 delay); | 542 delay); |
538 } | 543 } |
539 | 544 |
540 } // namespace net | 545 } // namespace net |
OLD | NEW |