| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 void HttpServerPropertiesImpl::InitializeSupportsQuic( | 103 void HttpServerPropertiesImpl::InitializeSupportsQuic( |
| 104 IPAddressNumber* last_address) { | 104 IPAddressNumber* last_address) { |
| 105 if (last_address) | 105 if (last_address) |
| 106 last_quic_address_ = *last_address; | 106 last_quic_address_ = *last_address; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void HttpServerPropertiesImpl::InitializeServerNetworkStats( | 109 void HttpServerPropertiesImpl::InitializeServerNetworkStats( |
| 110 ServerNetworkStatsMap* server_network_stats_map) { | 110 ServerNetworkStatsMap* server_network_stats_map) { |
| 111 // Add the entries from persisted data. |
| 112 ServerNetworkStatsMap new_server_network_stats_map( |
| 113 ServerNetworkStatsMap::NO_AUTO_EVICT); |
| 111 for (ServerNetworkStatsMap::reverse_iterator it = | 114 for (ServerNetworkStatsMap::reverse_iterator it = |
| 112 server_network_stats_map->rbegin(); | 115 server_network_stats_map->rbegin(); |
| 113 it != server_network_stats_map->rend(); ++it) { | 116 it != server_network_stats_map->rend(); ++it) { |
| 114 server_network_stats_map_.Put(it->first, it->second); | 117 new_server_network_stats_map.Put(it->first, it->second); |
| 118 } |
| 119 |
| 120 server_network_stats_map_.Swap(new_server_network_stats_map); |
| 121 |
| 122 // Add the entries from the memory cache. |
| 123 for (ServerNetworkStatsMap::reverse_iterator it = |
| 124 new_server_network_stats_map.rbegin(); |
| 125 it != new_server_network_stats_map.rend(); ++it) { |
| 126 if (server_network_stats_map_.Get(it->first) == |
| 127 server_network_stats_map_.end()) { |
| 128 server_network_stats_map_.Put(it->first, it->second); |
| 129 } |
| 115 } | 130 } |
| 116 } | 131 } |
| 117 | 132 |
| 118 void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( | 133 void HttpServerPropertiesImpl::InitializeQuicServerInfoMap( |
| 119 QuicServerInfoMap* quic_server_info_map) { | 134 QuicServerInfoMap* quic_server_info_map) { |
| 120 for (const std::pair<QuicServerId, std::string>& entry : | 135 for (const std::pair<QuicServerId, std::string>& entry : |
| 121 *quic_server_info_map) { | 136 *quic_server_info_map) { |
| 122 quic_server_info_map_.Put(entry.first, entry.second); | 137 quic_server_info_map_.Put(entry.first, entry.second); |
| 123 } | 138 } |
| 124 } | 139 } |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 733 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 719 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 734 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 720 FROM_HERE, | 735 FROM_HERE, |
| 721 base::Bind( | 736 base::Bind( |
| 722 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 737 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 723 weak_ptr_factory_.GetWeakPtr()), | 738 weak_ptr_factory_.GetWeakPtr()), |
| 724 delay); | 739 delay); |
| 725 } | 740 } |
| 726 | 741 |
| 727 } // namespace net | 742 } // namespace net |
| OLD | NEW |