| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const HostPortPair& server) { | 227 const HostPortPair& server) { |
| 228 if (g_forced_alternate_protocol) | 228 if (g_forced_alternate_protocol) |
| 229 return true; | 229 return true; |
| 230 AlternateProtocolMap::const_iterator it = | 230 AlternateProtocolMap::const_iterator it = |
| 231 GetAlternateProtocolIterator(server); | 231 GetAlternateProtocolIterator(server); |
| 232 return it != alternate_protocol_map_.end() && | 232 return it != alternate_protocol_map_.end() && |
| 233 it->second.probability >= alternate_protocol_probability_threshold_; | 233 it->second.probability >= alternate_protocol_probability_threshold_; |
| 234 } | 234 } |
| 235 | 235 |
| 236 std::string HttpServerPropertiesImpl::GetCanonicalSuffix( | 236 std::string HttpServerPropertiesImpl::GetCanonicalSuffix( |
| 237 const HostPortPair& server) { | 237 const std::string& host) { |
| 238 // If this host ends with a canonical suffix, then return the canonical | 238 // If this host ends with a canonical suffix, then return the canonical |
| 239 // suffix. | 239 // suffix. |
| 240 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { | 240 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { |
| 241 std::string canonical_suffix = canonical_suffixes_[i]; | 241 std::string canonical_suffix = canonical_suffixes_[i]; |
| 242 if (EndsWith(server.host(), canonical_suffixes_[i], false)) { | 242 if (EndsWith(host, canonical_suffixes_[i], false)) { |
| 243 return canonical_suffix; | 243 return canonical_suffix; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 return std::string(); | 246 return std::string(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 AlternateProtocolInfo | 249 AlternateProtocolInfo |
| 250 HttpServerPropertiesImpl::GetAlternateProtocol( | 250 HttpServerPropertiesImpl::GetAlternateProtocol( |
| 251 const HostPortPair& server) { | 251 const HostPortPair& server) { |
| 252 DCHECK(HasAlternateProtocol(server)); | 252 DCHECK(HasAlternateProtocol(server)); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 531 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 532 base::MessageLoop::current()->PostDelayedTask( | 532 base::MessageLoop::current()->PostDelayedTask( |
| 533 FROM_HERE, | 533 FROM_HERE, |
| 534 base::Bind( | 534 base::Bind( |
| 535 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 535 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 536 weak_ptr_factory_.GetWeakPtr()), | 536 weak_ptr_factory_.GetWeakPtr()), |
| 537 delay); | 537 delay); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace net | 540 } // namespace net |
| OLD | NEW |