| 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.h" | 8 #include "base/metrics/histogram.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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 bool HttpServerPropertiesManager::WasAlternativeServiceRecentlyBroken( | 238 bool HttpServerPropertiesManager::WasAlternativeServiceRecentlyBroken( |
| 239 const AlternativeService& alternative_service) { | 239 const AlternativeService& alternative_service) { |
| 240 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 240 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 241 return http_server_properties_impl_->WasAlternativeServiceRecentlyBroken( | 241 return http_server_properties_impl_->WasAlternativeServiceRecentlyBroken( |
| 242 alternative_service); | 242 alternative_service); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void HttpServerPropertiesManager::ConfirmAlternativeService( | 245 void HttpServerPropertiesManager::ConfirmAlternativeService( |
| 246 const AlternativeService& alternative_service) { | 246 const AlternativeService& alternative_service) { |
| 247 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 247 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 248 bool old_value = http_server_properties_impl_->IsAlternativeServiceBroken( |
| 249 alternative_service); |
| 248 http_server_properties_impl_->ConfirmAlternativeService(alternative_service); | 250 http_server_properties_impl_->ConfirmAlternativeService(alternative_service); |
| 249 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE); | 251 bool new_value = http_server_properties_impl_->IsAlternativeServiceBroken( |
| 252 alternative_service); |
| 253 // For persisting, we only care about the value returned by |
| 254 // IsAlternativeServiceBroken. If that value changes, then call persist. |
| 255 if (old_value != new_value) |
| 256 ScheduleUpdatePrefsOnNetworkThread(CONFIRM_ALTERNATIVE_SERVICE); |
| 250 } | 257 } |
| 251 | 258 |
| 252 void HttpServerPropertiesManager::ClearAlternativeService( | 259 void HttpServerPropertiesManager::ClearAlternativeService( |
| 253 const HostPortPair& origin) { | 260 const HostPortPair& origin) { |
| 254 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 261 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 255 const AlternativeServiceMap& map = | 262 const AlternativeServiceMap& map = |
| 256 http_server_properties_impl_->alternative_service_map(); | 263 http_server_properties_impl_->alternative_service_map(); |
| 257 size_t old_size = map.size(); | 264 size_t old_size = map.size(); |
| 258 http_server_properties_impl_->ClearAlternativeService(origin); | 265 http_server_properties_impl_->ClearAlternativeService(origin); |
| 259 size_t new_size = map.size(); | 266 size_t new_size = map.size(); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 server_network_stats_dict); | 978 server_network_stats_dict); |
| 972 } | 979 } |
| 973 | 980 |
| 974 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 981 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 975 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 982 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 976 if (!setting_prefs_) | 983 if (!setting_prefs_) |
| 977 ScheduleUpdateCacheOnPrefThread(); | 984 ScheduleUpdateCacheOnPrefThread(); |
| 978 } | 985 } |
| 979 | 986 |
| 980 } // namespace net | 987 } // namespace net |
| OLD | NEW |