Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 http_server_properties_impl_->GetServerNetworkStats(server); | 304 http_server_properties_impl_->GetServerNetworkStats(server); |
| 305 if (http_server_properties_impl_->GetServerNetworkStats(server)) | 305 if (http_server_properties_impl_->GetServerNetworkStats(server)) |
| 306 old_stats = *old_stats_ptr; | 306 old_stats = *old_stats_ptr; |
| 307 http_server_properties_impl_->SetServerNetworkStats(server, stats); | 307 http_server_properties_impl_->SetServerNetworkStats(server, stats); |
| 308 ServerNetworkStats new_stats = | 308 ServerNetworkStats new_stats = |
| 309 *(http_server_properties_impl_->GetServerNetworkStats(server)); | 309 *(http_server_properties_impl_->GetServerNetworkStats(server)); |
| 310 if (old_stats != new_stats) | 310 if (old_stats != new_stats) |
| 311 ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS); | 311 ScheduleUpdatePrefsOnNetworkThread(SET_SERVER_NETWORK_STATS); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void HttpServerPropertiesManager::ClearServerNetworkStats( | |
| 315 const url::SchemeHostPort& server) { | |
| 316 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | |
| 317 bool need_update = | |
| 318 http_server_properties_impl_->GetServerNetworkStats(server) != nullptr; | |
| 319 http_server_properties_impl_->ClearServerNetworkStats(server); | |
| 320 if (need_update) | |
| 321 ScheduleUpdatePrefsOnNetworkThread(CLEAR_SERVER_NETWORK_STATS); | |
|
Jana
2017/02/17 02:52:12
What's this for?
Ryan Hamilton
2017/02/17 03:41:53
The server properties manager persists the propert
Jana
2017/02/17 05:42:33
Gotcha. Ok, makes sense, thanks.
| |
| 322 } | |
| 323 | |
| 314 const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats( | 324 const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats( |
| 315 const url::SchemeHostPort& server) { | 325 const url::SchemeHostPort& server) { |
| 316 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 326 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 317 return http_server_properties_impl_->GetServerNetworkStats(server); | 327 return http_server_properties_impl_->GetServerNetworkStats(server); |
| 318 } | 328 } |
| 319 | 329 |
| 320 const ServerNetworkStatsMap& | 330 const ServerNetworkStatsMap& |
| 321 HttpServerPropertiesManager::server_network_stats_map() const { | 331 HttpServerPropertiesManager::server_network_stats_map() const { |
| 322 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 332 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 323 return http_server_properties_impl_->server_network_stats_map(); | 333 return http_server_properties_impl_->server_network_stats_map(); |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1122 if (!setting_prefs_) | 1132 if (!setting_prefs_) |
| 1123 ScheduleUpdateCacheOnPrefThread(); | 1133 ScheduleUpdateCacheOnPrefThread(); |
| 1124 } | 1134 } |
| 1125 | 1135 |
| 1126 void HttpServerPropertiesManager::SetInitialized() { | 1136 void HttpServerPropertiesManager::SetInitialized() { |
| 1127 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 1137 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 1128 is_initialized_ = true; | 1138 is_initialized_ = true; |
| 1129 } | 1139 } |
| 1130 | 1140 |
| 1131 } // namespace net | 1141 } // namespace net |
| OLD | NEW |