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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 it != spdy_servers->rend(); ++it) { | 46 it != spdy_servers->rend(); ++it) { |
47 spdy_servers_map_.Put(*it, support_spdy); | 47 spdy_servers_map_.Put(*it, support_spdy); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 void HttpServerPropertiesImpl::InitializeAlternateProtocolServers( | 51 void HttpServerPropertiesImpl::InitializeAlternateProtocolServers( |
52 AlternateProtocolMap* alternate_protocol_map) { | 52 AlternateProtocolMap* alternate_protocol_map) { |
53 // Keep all the broken ones since those don't get persisted. | 53 // Keep all the broken ones since those don't get persisted. |
54 for (AlternateProtocolMap::iterator it = alternate_protocol_map_.begin(); | 54 for (AlternateProtocolMap::iterator it = alternate_protocol_map_.begin(); |
55 it != alternate_protocol_map_.end();) { | 55 it != alternate_protocol_map_.end();) { |
56 AlternateProtocolMap::iterator old_it = it; | 56 if (it->second.is_broken) { |
57 ++it; | 57 ++it; |
58 if (!old_it->second.is_broken) { | 58 } else { |
59 alternate_protocol_map_.Erase(old_it); | 59 it = alternate_protocol_map_.Erase(it); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 // Add the entries from persisted data. | 63 // Add the entries from persisted data. |
64 for (AlternateProtocolMap::reverse_iterator it = | 64 for (AlternateProtocolMap::reverse_iterator it = |
65 alternate_protocol_map->rbegin(); | 65 alternate_protocol_map->rbegin(); |
66 it != alternate_protocol_map->rend(); ++it) { | 66 it != alternate_protocol_map->rend(); ++it) { |
67 alternate_protocol_map_.Put(it->first, it->second); | 67 alternate_protocol_map_.Put(it->first, it->second); |
68 } | 68 } |
69 | 69 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 530 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
531 base::MessageLoop::current()->PostDelayedTask( | 531 base::MessageLoop::current()->PostDelayedTask( |
532 FROM_HERE, | 532 FROM_HERE, |
533 base::Bind( | 533 base::Bind( |
534 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 534 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
535 weak_ptr_factory_.GetWeakPtr()), | 535 weak_ptr_factory_.GetWeakPtr()), |
536 delay); | 536 delay); |
537 } | 537 } |
538 | 538 |
539 } // namespace net | 539 } // namespace net |
OLD | NEW |