| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 ServerNetworkStatsMap* server_network_stats_map) { | 110 ServerNetworkStatsMap* server_network_stats_map) { |
| 111 for (ServerNetworkStatsMap::reverse_iterator it = | 111 for (ServerNetworkStatsMap::reverse_iterator it = |
| 112 server_network_stats_map->rbegin(); | 112 server_network_stats_map->rbegin(); |
| 113 it != server_network_stats_map->rend(); ++it) { | 113 it != server_network_stats_map->rend(); ++it) { |
| 114 server_network_stats_map_.Put(it->first, it->second); | 114 server_network_stats_map_.Put(it->first, it->second); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( | 118 void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( |
| 119 QuicServerInfoMap* quic_server_info_map) { | 119 QuicServerInfoMap* quic_server_info_map) { |
| 120 for (const std::pair<QuicServerId, std::string>& entry : | 120 // Add the entries from persisted data. |
| 121 *quic_server_info_map) { | 121 QuicServerInfoMap temp_map(kMaxQuicServersToPersist); |
| 122 quic_server_info_map_.Put(entry.first, entry.second); | 122 for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map->rbegin(); |
| 123 it != quic_server_info_map->rend(); ++it) { |
| 124 temp_map.Put(it->first, it->second); |
| 125 } |
| 126 |
| 127 quic_server_info_map_.Swap(temp_map); |
| 128 |
| 129 // Add the entries from the memory cache. |
| 130 for (QuicServerInfoMap::reverse_iterator it = temp_map.rbegin(); |
| 131 it != temp_map.rend(); ++it) { |
| 132 if (quic_server_info_map_.Get(it->first) == quic_server_info_map_.end()) { |
| 133 quic_server_info_map_.Put(it->first, it->second); |
| 134 } |
| 123 } | 135 } |
| 124 } | 136 } |
| 125 | 137 |
| 126 void HttpServerPropertiesImpl::GetSpdyServerList( | 138 void HttpServerPropertiesImpl::GetSpdyServerList( |
| 127 base::ListValue* spdy_server_list, | 139 base::ListValue* spdy_server_list, |
| 128 size_t max_size) const { | 140 size_t max_size) const { |
| 129 DCHECK(CalledOnValidThread()); | 141 DCHECK(CalledOnValidThread()); |
| 130 DCHECK(spdy_server_list); | 142 DCHECK(spdy_server_list); |
| 131 spdy_server_list->Clear(); | 143 spdy_server_list->Clear(); |
| 132 size_t count = 0; | 144 size_t count = 0; |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 730 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 719 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 731 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 720 FROM_HERE, | 732 FROM_HERE, |
| 721 base::Bind( | 733 base::Bind( |
| 722 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 734 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 723 weak_ptr_factory_.GetWeakPtr()), | 735 weak_ptr_factory_.GetWeakPtr()), |
| 724 delay); | 736 delay); |
| 725 } | 737 } |
| 726 | 738 |
| 727 } // namespace net | 739 } // namespace net |
| OLD | NEW |