| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/net/http_server_properties_manager.h" | 5 #include "chrome/browser/net/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/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 const net::SpdySettingsMap& | 263 const net::SpdySettingsMap& |
| 264 HttpServerPropertiesManager::spdy_settings_map() const { | 264 HttpServerPropertiesManager::spdy_settings_map() const { |
| 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 266 return http_server_properties_impl_->spdy_settings_map(); | 266 return http_server_properties_impl_->spdy_settings_map(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void HttpServerPropertiesManager::SetServerNetworkStats( | 269 void HttpServerPropertiesManager::SetServerNetworkStats( |
| 270 const net::HostPortPair& host_port_pair, | 270 const net::HostPortPair& host_port_pair, |
| 271 NetworkStats stats) { | 271 NetworkStats stats) { |
| 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 272 http_server_properties_impl_->SetServerNetworkStats(host_port_pair, stats); | 273 http_server_properties_impl_->SetServerNetworkStats(host_port_pair, stats); |
| 273 } | 274 } |
| 274 | 275 |
| 275 const HttpServerPropertiesManager::NetworkStats* | 276 const HttpServerPropertiesManager::NetworkStats* |
| 276 HttpServerPropertiesManager::GetServerNetworkStats( | 277 HttpServerPropertiesManager::GetServerNetworkStats( |
| 277 const net::HostPortPair& host_port_pair) const { | 278 const net::HostPortPair& host_port_pair) const { |
| 279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 278 return http_server_properties_impl_->GetServerNetworkStats(host_port_pair); | 280 return http_server_properties_impl_->GetServerNetworkStats(host_port_pair); |
| 279 } | 281 } |
| 280 | 282 |
| 281 // | 283 // |
| 282 // Update the HttpServerPropertiesImpl's cache with data from preferences. | 284 // Update the HttpServerPropertiesImpl's cache with data from preferences. |
| 283 // | 285 // |
| 284 void HttpServerPropertiesManager::ScheduleUpdateCacheOnUI() { | 286 void HttpServerPropertiesManager::ScheduleUpdateCacheOnUI() { |
| 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 286 // Cancel pending updates, if any. | 288 // Cancel pending updates, if any. |
| 287 ui_cache_update_timer_->Stop(); | 289 ui_cache_update_timer_->Stop(); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 completion.Run(); | 717 completion.Run(); |
| 716 } | 718 } |
| 717 | 719 |
| 718 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 720 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 719 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 721 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 720 if (!setting_prefs_) | 722 if (!setting_prefs_) |
| 721 ScheduleUpdateCacheOnUI(); | 723 ScheduleUpdateCacheOnUI(); |
| 722 } | 724 } |
| 723 | 725 |
| 724 } // namespace chrome_browser_net | 726 } // namespace chrome_browser_net |
| OLD | NEW |