| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Add the entries from persisted data. | 62 // Add the entries from persisted data. |
| 63 for (AlternateProtocolMap::reverse_iterator it = | 63 for (AlternateProtocolMap::reverse_iterator it = |
| 64 alternate_protocol_map->rbegin(); | 64 alternate_protocol_map->rbegin(); |
| 65 it != alternate_protocol_map->rend(); ++it) { | 65 it != alternate_protocol_map->rend(); ++it) { |
| 66 alternate_protocol_map_.Put(it->first, it->second); | 66 alternate_protocol_map_.Put(it->first, it->second); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Attempt to find canonical servers. | 69 // Attempt to find canonical servers. |
| 70 int canonical_ports[] = { 80, 443 }; | 70 uint16 canonical_ports[] = { 80, 443 }; |
| 71 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { | 71 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { |
| 72 std::string canonical_suffix = canonical_suffixes_[i]; | 72 std::string canonical_suffix = canonical_suffixes_[i]; |
| 73 for (size_t j = 0; j < arraysize(canonical_ports); ++j) { | 73 for (size_t j = 0; j < arraysize(canonical_ports); ++j) { |
| 74 HostPortPair canonical_host(canonical_suffix, canonical_ports[j]); | 74 HostPortPair canonical_host(canonical_suffix, canonical_ports[j]); |
| 75 // If we already have a valid canonical server, we're done. | 75 // If we already have a valid canonical server, we're done. |
| 76 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) && | 76 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) && |
| 77 (alternate_protocol_map_.Peek(canonical_host_to_origin_map_[ | 77 (alternate_protocol_map_.Peek(canonical_host_to_origin_map_[ |
| 78 canonical_host]) != alternate_protocol_map_.end())) { | 78 canonical_host]) != alternate_protocol_map_.end())) { |
| 79 continue; | 79 continue; |
| 80 } | 80 } |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 491 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 492 base::MessageLoop::current()->PostDelayedTask( | 492 base::MessageLoop::current()->PostDelayedTask( |
| 493 FROM_HERE, | 493 FROM_HERE, |
| 494 base::Bind( | 494 base::Bind( |
| 495 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 495 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 496 weak_ptr_factory_.GetWeakPtr()), | 496 weak_ptr_factory_.GetWeakPtr()), |
| 497 delay); | 497 delay); |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace net | 500 } // namespace net |
| OLD | NEW |