| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 network_weak_ptr_factory_.reset(); | 93 network_weak_ptr_factory_.reset(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void HttpServerPropertiesManager::InitializeOnNetworkThread() { | 96 void HttpServerPropertiesManager::InitializeOnNetworkThread() { |
| 97 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); | 97 DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); |
| 98 network_weak_ptr_factory_.reset( | 98 network_weak_ptr_factory_.reset( |
| 99 new base::WeakPtrFactory<HttpServerPropertiesManager>(this)); | 99 new base::WeakPtrFactory<HttpServerPropertiesManager>(this)); |
| 100 http_server_properties_impl_.reset(new HttpServerPropertiesImpl()); | 100 http_server_properties_impl_.reset(new HttpServerPropertiesImpl()); |
| 101 | 101 |
| 102 network_prefs_update_timer_.reset(new base::OneShotTimer); | 102 network_prefs_update_timer_.reset(new base::OneShotTimer); |
| 103 | 103 network_prefs_update_timer_->SetTaskRunner(network_task_runner_); |
| 104 pref_task_runner_->PostTask( | 104 pref_task_runner_->PostTask( |
| 105 FROM_HERE, | 105 FROM_HERE, |
| 106 base::Bind(&HttpServerPropertiesManager::UpdateCacheFromPrefsOnPrefThread, | 106 base::Bind(&HttpServerPropertiesManager::UpdateCacheFromPrefsOnPrefThread, |
| 107 pref_weak_ptr_)); | 107 pref_weak_ptr_)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void HttpServerPropertiesManager::ShutdownOnPrefThread() { | 110 void HttpServerPropertiesManager::ShutdownOnPrefThread() { |
| 111 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 111 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 112 // Cancel any pending updates, and stop listening for pref change updates. | 112 // Cancel any pending updates, and stop listening for pref change updates. |
| 113 pref_cache_update_timer_->Stop(); | 113 pref_cache_update_timer_->Stop(); |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 quic_servers_dict); | 1115 quic_servers_dict); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 1118 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 1119 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1119 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 1120 if (!setting_prefs_) | 1120 if (!setting_prefs_) |
| 1121 ScheduleUpdateCacheOnPrefThread(); | 1121 ScheduleUpdateCacheOnPrefThread(); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 } // namespace net | 1124 } // namespace net |
| OLD | NEW |