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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 816 } |
816 | 817 |
817 void HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread( | 818 void HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread( |
818 ServerList* spdy_servers, | 819 ServerList* spdy_servers, |
819 SpdySettingsMap* spdy_settings_map, | 820 SpdySettingsMap* spdy_settings_map, |
820 AlternativeServiceMap* alternative_service_map, | 821 AlternativeServiceMap* alternative_service_map, |
821 IPAddress* last_quic_address, | 822 IPAddress* last_quic_address, |
822 ServerNetworkStatsMap* server_network_stats_map, | 823 ServerNetworkStatsMap* server_network_stats_map, |
823 QuicServerInfoMap* quic_server_info_map, | 824 QuicServerInfoMap* quic_server_info_map, |
824 bool detected_corrupted_prefs) { | 825 bool detected_corrupted_prefs) { |
| 826 TRACE_EVENT0( |
| 827 "net", |
| 828 "HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread"); |
825 // Preferences have the master data because admins might have pushed new | 829 // Preferences have the master data because admins might have pushed new |
826 // preferences. Update the cached data with new data from preferences. | 830 // preferences. Update the cached data with new data from preferences. |
827 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 831 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
828 | 832 |
829 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdyServers", spdy_servers->size()); | 833 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdyServers", spdy_servers->size()); |
830 http_server_properties_impl_->InitializeSpdyServers(spdy_servers, true); | 834 http_server_properties_impl_->InitializeSpdyServers(spdy_servers, true); |
831 | 835 |
832 // Update the cached data and use the new spdy_settings from preferences. | 836 // Update the cached data and use the new spdy_settings from preferences. |
833 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdySettings", spdy_settings_map->size()); | 837 UMA_HISTOGRAM_COUNTS("Net.CountOfSpdySettings", spdy_settings_map->size()); |
834 http_server_properties_impl_->InitializeSpdySettingsServers( | 838 http_server_properties_impl_->InitializeSpdySettingsServers( |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 quic_servers_dict); | 1243 quic_servers_dict); |
1240 } | 1244 } |
1241 | 1245 |
1242 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 1246 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
1243 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1247 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
1244 if (!setting_prefs_) | 1248 if (!setting_prefs_) |
1245 ScheduleUpdateCacheOnPrefThread(); | 1249 ScheduleUpdateCacheOnPrefThread(); |
1246 } | 1250 } |
1247 | 1251 |
1248 } // namespace net | 1252 } // namespace net |
OLD | NEW |