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

Side by Side Diff: remoting/host/setup/daemon_controller.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: Created 4 years, 12 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/setup/daemon_controller.h" 5 #include "remoting/host/setup/daemon_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "remoting/base/auto_thread.h" 12 #include "remoting/base/auto_thread.h"
13 #include "remoting/base/auto_thread_task_runner.h" 13 #include "remoting/base/auto_thread_task_runner.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 // Name of the Daemon Controller's worker thread. 17 // Name of the Daemon Controller's worker thread.
18 const char kDaemonControllerThreadName[] = "Daemon Controller thread"; 18 const char kDaemonControllerThreadName[] = "Daemon Controller thread";
19 19
20 DaemonController::DaemonController(scoped_ptr<Delegate> delegate) 20 DaemonController::DaemonController(scoped_ptr<Delegate> delegate)
21 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), 21 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
22 delegate_(delegate.Pass()) { 22 delegate_(std::move(delegate)) {
23 // Launch the delegate thread. 23 // Launch the delegate thread.
24 delegate_thread_.reset(new AutoThread(kDaemonControllerThreadName)); 24 delegate_thread_.reset(new AutoThread(kDaemonControllerThreadName));
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 delegate_thread_->SetComInitType(AutoThread::COM_INIT_STA); 26 delegate_thread_->SetComInitType(AutoThread::COM_INIT_STA);
27 delegate_task_runner_ = 27 delegate_task_runner_ =
28 delegate_thread_->StartWithType(base::MessageLoop::TYPE_UI); 28 delegate_thread_->StartWithType(base::MessageLoop::TYPE_UI);
29 #else 29 #else
30 delegate_task_runner_ = 30 delegate_task_runner_ =
31 delegate_thread_->StartWithType(base::MessageLoop::TYPE_DEFAULT); 31 delegate_thread_->StartWithType(base::MessageLoop::TYPE_DEFAULT);
32 #endif 32 #endif
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 caller_task_runner_->PostTask(FROM_HERE, 110 caller_task_runner_->PostTask(FROM_HERE,
111 base::Bind(done, base::Passed(&config))); 111 base::Bind(done, base::Passed(&config)));
112 } 112 }
113 113
114 void DaemonController::DoSetConfigAndStart( 114 void DaemonController::DoSetConfigAndStart(
115 scoped_ptr<base::DictionaryValue> config, 115 scoped_ptr<base::DictionaryValue> config,
116 bool consent, 116 bool consent,
117 const CompletionCallback& done) { 117 const CompletionCallback& done) {
118 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 118 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
119 119
120 delegate_->SetConfigAndStart(config.Pass(), consent, done); 120 delegate_->SetConfigAndStart(std::move(config), consent, done);
121 } 121 }
122 122
123 void DaemonController::DoUpdateConfig( 123 void DaemonController::DoUpdateConfig(
124 scoped_ptr<base::DictionaryValue> config, 124 scoped_ptr<base::DictionaryValue> config,
125 const CompletionCallback& done) { 125 const CompletionCallback& done) {
126 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 126 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
127 127
128 delegate_->UpdateConfig(config.Pass(), done); 128 delegate_->UpdateConfig(std::move(config), done);
129 } 129 }
130 130
131 void DaemonController::DoStop(const CompletionCallback& done) { 131 void DaemonController::DoStop(const CompletionCallback& done) {
132 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 132 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
133 133
134 delegate_->Stop(done); 134 delegate_->Stop(done);
135 } 135 }
136 136
137 void DaemonController::DoGetUsageStatsConsent( 137 void DaemonController::DoGetUsageStatsConsent(
138 const GetUsageStatsConsentCallback& done) { 138 const GetUsageStatsConsentCallback& done) {
(...skipping 17 matching lines...) Expand all
156 156
157 done.Run(result); 157 done.Run(result);
158 ScheduleNext(); 158 ScheduleNext();
159 } 159 }
160 160
161 void DaemonController::InvokeConfigCallbackAndScheduleNext( 161 void DaemonController::InvokeConfigCallbackAndScheduleNext(
162 const GetConfigCallback& done, 162 const GetConfigCallback& done,
163 scoped_ptr<base::DictionaryValue> config) { 163 scoped_ptr<base::DictionaryValue> config) {
164 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 164 DCHECK(caller_task_runner_->BelongsToCurrentThread());
165 165
166 done.Run(config.Pass()); 166 done.Run(std::move(config));
167 ScheduleNext(); 167 ScheduleNext();
168 } 168 }
169 169
170 void DaemonController::InvokeConsentCallbackAndScheduleNext( 170 void DaemonController::InvokeConsentCallbackAndScheduleNext(
171 const GetUsageStatsConsentCallback& done, 171 const GetUsageStatsConsentCallback& done,
172 const UsageStatsConsent& consent) { 172 const UsageStatsConsent& consent) {
173 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 173 DCHECK(caller_task_runner_->BelongsToCurrentThread());
174 174
175 done.Run(consent); 175 done.Run(consent);
176 ScheduleNext(); 176 ScheduleNext();
(...skipping 12 matching lines...) Expand all
189 if (!servicing_request) 189 if (!servicing_request)
190 ServiceNextRequest(); 190 ServiceNextRequest();
191 } 191 }
192 192
193 void DaemonController::ServiceNextRequest() { 193 void DaemonController::ServiceNextRequest() {
194 if (!pending_requests_.empty()) 194 if (!pending_requests_.empty())
195 delegate_task_runner_->PostTask(FROM_HERE, pending_requests_.front()); 195 delegate_task_runner_->PostTask(FROM_HERE, pending_requests_.front());
196 } 196 }
197 197
198 } // namespace remoting 198 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698