| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 } | 883 } |
| 884 if (IsAlternativeServiceBroken(alternative_service)) { | 884 if (IsAlternativeServiceBroken(alternative_service)) { |
| 885 continue; | 885 continue; |
| 886 } | 886 } |
| 887 notbroken_alternative_service_info_vector.push_back( | 887 notbroken_alternative_service_info_vector.push_back( |
| 888 alternative_service_info); | 888 alternative_service_info); |
| 889 } | 889 } |
| 890 if (notbroken_alternative_service_info_vector.empty()) { | 890 if (notbroken_alternative_service_info_vector.empty()) { |
| 891 continue; | 891 continue; |
| 892 } | 892 } |
| 893 alternative_service_map->Put(server, | |
| 894 notbroken_alternative_service_info_vector); | |
| 895 std::string canonical_suffix = | 893 std::string canonical_suffix = |
| 896 http_server_properties_impl_->GetCanonicalSuffix(server.host()); | 894 http_server_properties_impl_->GetCanonicalSuffix(server.host()); |
| 897 if (!canonical_suffix.empty()) { | 895 if (!canonical_suffix.empty()) { |
| 898 if (persisted_map.find(canonical_suffix) != persisted_map.end()) | 896 if (persisted_map.find(canonical_suffix) != persisted_map.end()) |
| 899 continue; | 897 continue; |
| 900 persisted_map[canonical_suffix] = true; | 898 persisted_map[canonical_suffix] = true; |
| 901 } | 899 } |
| 900 alternative_service_map->Put(server, |
| 901 notbroken_alternative_service_info_vector); |
| 902 ++count; | 902 ++count; |
| 903 } | 903 } |
| 904 | 904 |
| 905 ServerNetworkStatsMap* server_network_stats_map = | 905 ServerNetworkStatsMap* server_network_stats_map = |
| 906 new ServerNetworkStatsMap(kMaxServerNetworkStatsHostsToPersist); | 906 new ServerNetworkStatsMap(kMaxServerNetworkStatsHostsToPersist); |
| 907 const ServerNetworkStatsMap& main_server_network_stats_map = | 907 const ServerNetworkStatsMap& network_stats_map = |
| 908 http_server_properties_impl_->server_network_stats_map(); | 908 http_server_properties_impl_->server_network_stats_map(); |
| 909 for (ServerNetworkStatsMap::const_iterator it = | 909 count = 0; |
| 910 main_server_network_stats_map.begin(); | 910 for (ServerNetworkStatsMap::const_iterator it = network_stats_map.begin(); |
| 911 it != main_server_network_stats_map.end(); ++it) { | 911 it != network_stats_map.end() && |
| 912 count < kMaxServerNetworkStatsHostsToPersist; |
| 913 ++it, ++count) { |
| 912 server_network_stats_map->Put(it->first, it->second); | 914 server_network_stats_map->Put(it->first, it->second); |
| 913 } | 915 } |
| 914 | 916 |
| 915 QuicServerInfoMap* quic_server_info_map = NULL; | 917 QuicServerInfoMap* quic_server_info_map = NULL; |
| 916 const QuicServerInfoMap& main_quic_server_info_map = | 918 const QuicServerInfoMap& main_quic_server_info_map = |
| 917 http_server_properties_impl_->quic_server_info_map(); | 919 http_server_properties_impl_->quic_server_info_map(); |
| 918 if (main_quic_server_info_map.size() > 0) { | 920 if (main_quic_server_info_map.size() > 0) { |
| 919 quic_server_info_map = new QuicServerInfoMap(kMaxQuicServersToPersist); | 921 quic_server_info_map = new QuicServerInfoMap(kMaxQuicServersToPersist); |
| 920 for (const std::pair<const QuicServerId, std::string>& entry : | 922 for (const std::pair<const QuicServerId, std::string>& entry : |
| 921 main_quic_server_info_map) { | 923 main_quic_server_info_map) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 quic_servers_dict); | 1159 quic_servers_dict); |
| 1158 } | 1160 } |
| 1159 | 1161 |
| 1160 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 1162 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 1161 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1163 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 1162 if (!setting_prefs_) | 1164 if (!setting_prefs_) |
| 1163 ScheduleUpdateCacheOnPrefThread(); | 1165 ScheduleUpdateCacheOnPrefThread(); |
| 1164 } | 1166 } |
| 1165 | 1167 |
| 1166 } // namespace net | 1168 } // namespace net |
| OLD | NEW |