| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 last_quic_address_.clear(); | 150 last_quic_address_.clear(); |
| 151 server_network_stats_map_.Clear(); | 151 server_network_stats_map_.Clear(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool HttpServerPropertiesImpl::SupportsRequestPriority( | 154 bool HttpServerPropertiesImpl::SupportsRequestPriority( |
| 155 const HostPortPair& host_port_pair) { | 155 const HostPortPair& host_port_pair) { |
| 156 DCHECK(CalledOnValidThread()); | 156 DCHECK(CalledOnValidThread()); |
| 157 if (host_port_pair.host().empty()) | 157 if (host_port_pair.host().empty()) |
| 158 return false; | 158 return false; |
| 159 | 159 |
| 160 SpdyServerHostPortMap::iterator spdy_host_port = | 160 if (GetSupportsSpdy(host_port_pair)) |
| 161 spdy_servers_map_.Get(host_port_pair.ToString()); | |
| 162 if (spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second) | |
| 163 return true; | 161 return true; |
| 164 | 162 |
| 165 const AlternativeService alternative_service = | 163 const AlternativeService alternative_service = |
| 166 GetAlternativeService(host_port_pair); | 164 GetAlternativeService(host_port_pair); |
| 167 return alternative_service.protocol == QUIC; | 165 return alternative_service.protocol == QUIC; |
| 168 } | 166 } |
| 169 | 167 |
| 168 bool HttpServerPropertiesImpl::GetSupportsSpdy( |
| 169 const HostPortPair& host_port_pair) { |
| 170 DCHECK(CalledOnValidThread()); |
| 171 if (host_port_pair.host().empty()) |
| 172 return false; |
| 173 |
| 174 SpdyServerHostPortMap::iterator spdy_host_port = |
| 175 spdy_servers_map_.Get(host_port_pair.ToString()); |
| 176 return spdy_host_port != spdy_servers_map_.end() && spdy_host_port->second; |
| 177 } |
| 178 |
| 170 void HttpServerPropertiesImpl::SetSupportsSpdy( | 179 void HttpServerPropertiesImpl::SetSupportsSpdy( |
| 171 const HostPortPair& host_port_pair, | 180 const HostPortPair& host_port_pair, |
| 172 bool support_spdy) { | 181 bool support_spdy) { |
| 173 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
| 174 if (host_port_pair.host().empty()) | 183 if (host_port_pair.host().empty()) |
| 175 return; | 184 return; |
| 176 | 185 |
| 177 SpdyServerHostPortMap::iterator spdy_host_port = | 186 SpdyServerHostPortMap::iterator spdy_host_port = |
| 178 spdy_servers_map_.Get(host_port_pair.ToString()); | 187 spdy_servers_map_.Get(host_port_pair.ToString()); |
| 179 if ((spdy_host_port != spdy_servers_map_.end()) && | 188 if ((spdy_host_port != spdy_servers_map_.end()) && |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 603 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 595 base::MessageLoop::current()->PostDelayedTask( | 604 base::MessageLoop::current()->PostDelayedTask( |
| 596 FROM_HERE, | 605 FROM_HERE, |
| 597 base::Bind( | 606 base::Bind( |
| 598 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 607 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 599 weak_ptr_factory_.GetWeakPtr()), | 608 weak_ptr_factory_.GetWeakPtr()), |
| 600 delay); | 609 delay); |
| 601 } | 610 } |
| 602 | 611 |
| 603 } // namespace net | 612 } // namespace net |
| OLD | NEW |