Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: net/http/http_server_properties_manager.cc

Issue 2563273002: Change the net_task_runner to use a TestMockTimeTaskRunner in unittests so that (Closed)
Patch Set: Move SetTaskRunner to HttpServerPropertiesManager Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(std::move(network_task_runner_));
Ryan Hamilton 2016/12/12 05:30:20 Do you need to move the task runner? It's a scoped
Zhongyi Shi 2016/12/12 21:14:46 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698