| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 | 310 |
| 311 void HttpServerPropertiesManager::SetSupportsQuic( | 311 void HttpServerPropertiesManager::SetSupportsQuic( |
| 312 bool used_quic, | 312 bool used_quic, |
| 313 const IPAddressNumber& address) { | 313 const IPAddressNumber& address) { |
| 314 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 314 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 315 http_server_properties_impl_->SetSupportsQuic(used_quic, address); | 315 http_server_properties_impl_->SetSupportsQuic(used_quic, address); |
| 316 ScheduleUpdatePrefsOnNetworkThread(SET_SUPPORTS_QUIC); | 316 ScheduleUpdatePrefsOnNetworkThread(SET_SUPPORTS_QUIC); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void HttpServerPropertiesManager::SetServerNetworkStats( | 319 bool HttpServerPropertiesManager::SetServerNetworkStats( |
| 320 const HostPortPair& host_port_pair, | 320 const HostPortPair& host_port_pair, |
| 321 ServerNetworkStats stats) { | 321 ServerNetworkStats stats) { |
| 322 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 322 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 323 http_server_properties_impl_->SetServerNetworkStats(host_port_pair, stats); | 323 if (http_server_properties_impl_->SetServerNetworkStats(host_port_pair, |
| 324 ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS); | 324 stats)) { |
| 325 ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS); |
| 326 return true; |
| 327 } |
| 328 return false; |
| 325 } | 329 } |
| 326 | 330 |
| 327 const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats( | 331 const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats( |
| 328 const HostPortPair& host_port_pair) { | 332 const HostPortPair& host_port_pair) { |
| 329 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 333 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 330 return http_server_properties_impl_->GetServerNetworkStats(host_port_pair); | 334 return http_server_properties_impl_->GetServerNetworkStats(host_port_pair); |
| 331 } | 335 } |
| 332 | 336 |
| 333 const ServerNetworkStatsMap& | 337 const ServerNetworkStatsMap& |
| 334 HttpServerPropertiesManager::server_network_stats_map() const { | 338 HttpServerPropertiesManager::server_network_stats_map() const { |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 server_network_stats_dict); | 957 server_network_stats_dict); |
| 954 } | 958 } |
| 955 | 959 |
| 956 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 960 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 957 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 961 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 958 if (!setting_prefs_) | 962 if (!setting_prefs_) |
| 959 ScheduleUpdateCacheOnPrefThread(); | 963 ScheduleUpdateCacheOnPrefThread(); |
| 960 } | 964 } |
| 961 | 965 |
| 962 } // namespace net | 966 } // namespace net |
| OLD | NEW |