| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool HttpServerPropertiesManager::GetSupportsQuic( | 330 bool HttpServerPropertiesManager::GetSupportsQuic( |
| 331 IPAddressNumber* last_address) const { | 331 IPAddressNumber* last_address) const { |
| 332 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 332 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 333 return http_server_properties_impl_->GetSupportsQuic(last_address); | 333 return http_server_properties_impl_->GetSupportsQuic(last_address); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void HttpServerPropertiesManager::SetSupportsQuic( | 336 void HttpServerPropertiesManager::SetSupportsQuic( |
| 337 bool used_quic, | 337 bool used_quic, |
| 338 const IPAddressNumber& address) { | 338 const IPAddressNumber& address) { |
| 339 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 339 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 340 IPAddressNumber old_last_quic_addr; |
| 341 http_server_properties_impl_->GetSupportsQuic(&old_last_quic_addr); |
| 340 http_server_properties_impl_->SetSupportsQuic(used_quic, address); | 342 http_server_properties_impl_->SetSupportsQuic(used_quic, address); |
| 341 ScheduleUpdatePrefsOnNetworkThread(SET_SUPPORTS_QUIC); | 343 IPAddressNumber new_last_quic_addr; |
| 344 http_server_properties_impl_->GetSupportsQuic(&new_last_quic_addr); |
| 345 if (old_last_quic_addr != new_last_quic_addr) |
| 346 ScheduleUpdatePrefsOnNetworkThread(SET_SUPPORTS_QUIC); |
| 342 } | 347 } |
| 343 | 348 |
| 344 void HttpServerPropertiesManager::SetServerNetworkStats( | 349 void HttpServerPropertiesManager::SetServerNetworkStats( |
| 345 const HostPortPair& host_port_pair, | 350 const HostPortPair& host_port_pair, |
| 346 ServerNetworkStats stats) { | 351 ServerNetworkStats stats) { |
| 347 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 352 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 348 ServerNetworkStats old_stats; | 353 ServerNetworkStats old_stats; |
| 349 const ServerNetworkStats* old_stats_ptr = | 354 const ServerNetworkStats* old_stats_ptr = |
| 350 http_server_properties_impl_->GetServerNetworkStats(host_port_pair); | 355 http_server_properties_impl_->GetServerNetworkStats(host_port_pair); |
| 351 if (http_server_properties_impl_->GetServerNetworkStats(host_port_pair)) | 356 if (http_server_properties_impl_->GetServerNetworkStats(host_port_pair)) |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 server_network_stats_dict); | 991 server_network_stats_dict); |
| 987 } | 992 } |
| 988 | 993 |
| 989 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 994 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 990 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 995 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 991 if (!setting_prefs_) | 996 if (!setting_prefs_) |
| 992 ScheduleUpdateCacheOnPrefThread(); | 997 ScheduleUpdateCacheOnPrefThread(); |
| 993 } | 998 } |
| 994 | 999 |
| 995 } // namespace net | 1000 } // namespace net |
| OLD | NEW |