| 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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/trace_event/trace_event.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "net/base/ip_address.h" | 16 #include "net/base/ip_address.h" |
| 16 #include "net/base/port_util.h" | 17 #include "net/base/port_util.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Time to wait before starting an update the http_server_properties_impl_ cache | 23 // Time to wait before starting an update the http_server_properties_impl_ cache |
| 23 // from preferences. Scheduling another update during this period will reset the | 24 // from preferences. Scheduling another update during this period will reset the |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 } | 835 } |
| 835 | 836 |
| 836 void HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread( | 837 void HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread( |
| 837 ServerList* spdy_servers, | 838 ServerList* spdy_servers, |
| 838 SpdySettingsMap* spdy_settings_map, | 839 SpdySettingsMap* spdy_settings_map, |
| 839 AlternativeServiceMap* alternative_service_map, | 840 AlternativeServiceMap* alternative_service_map, |
| 840 IPAddress* last_quic_address, | 841 IPAddress* last_quic_address, |
| 841 ServerNetworkStatsMap* server_network_stats_map, | 842 ServerNetworkStatsMap* server_network_stats_map, |
| 842 QuicServerInfoMap* quic_server_info_map, | 843 QuicServerInfoMap* quic_server_info_map, |
| 843 bool detected_corrupted_prefs) { | 844 bool detected_corrupted_prefs) { |
| 845 TRACE_EVENT0( |
| 846 "net", |
| 847 "HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread"); |
| 844 // Preferences have the master data because admins might have pushed new | 848 // Preferences have the master data because admins might have pushed new |
| 845 // preferences. Update the cached data with new data from preferences. | 849 // preferences. Update the cached data with new data from preferences. |
| 846 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 850 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 847 | 851 |
| 848 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdyServers", spdy_servers->size()); | 852 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdyServers", spdy_servers->size()); |
| 849 http_server_properties_impl_->InitializeSpdyServers(spdy_servers, true); | 853 http_server_properties_impl_->InitializeSpdyServers(spdy_servers, true); |
| 850 | 854 |
| 851 // Update the cached data and use the new spdy_settings from preferences. | 855 // Update the cached data and use the new spdy_settings from preferences. |
| 852 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdySettings", spdy_settings_map->size()); | 856 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdySettings", spdy_settings_map->size()); |
| 853 http_server_properties_impl_->InitializeSpdySettingsServers( | 857 http_server_properties_impl_->InitializeSpdySettingsServers( |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 quic_servers_dict); | 1264 quic_servers_dict); |
| 1261 } | 1265 } |
| 1262 | 1266 |
| 1263 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 1267 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 1264 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1268 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 1265 if (!setting_prefs_) | 1269 if (!setting_prefs_) |
| 1266 ScheduleUpdateCacheOnPrefThread(); | 1270 ScheduleUpdateCacheOnPrefThread(); |
| 1267 } | 1271 } |
| 1268 | 1272 |
| 1269 } // namespace net | 1273 } // namespace net |
| OLD | NEW |