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 "remoting/base/auto_thread_task_runner.h" | 5 #include "remoting/base/auto_thread_task_runner.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 | 10 |
9 namespace remoting { | 11 namespace remoting { |
10 | 12 |
11 AutoThreadTaskRunner::AutoThreadTaskRunner( | 13 AutoThreadTaskRunner::AutoThreadTaskRunner( |
12 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 14 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
13 const base::Closure& stop_task) | 15 base::Closure stop_task) |
14 : stop_task_(stop_task), | 16 : stop_task_(std::move(stop_task)), task_runner_(task_runner) { |
15 task_runner_(task_runner) { | |
16 DCHECK(!stop_task_.is_null()); | 17 DCHECK(!stop_task_.is_null()); |
17 } | 18 } |
18 | 19 |
19 bool AutoThreadTaskRunner::PostDelayedTask( | 20 bool AutoThreadTaskRunner::PostDelayedTask( |
20 const tracked_objects::Location& from_here, | 21 const tracked_objects::Location& from_here, |
21 const base::Closure& task, | 22 base::Closure task, |
22 base::TimeDelta delay) { | 23 base::TimeDelta delay) { |
23 CHECK(task_runner_->PostDelayedTask(from_here, task, delay)); | 24 CHECK(task_runner_->PostDelayedTask(from_here, std::move(task), delay)); |
24 return true; | 25 return true; |
25 } | 26 } |
26 | 27 |
27 bool AutoThreadTaskRunner::PostNonNestableDelayedTask( | 28 bool AutoThreadTaskRunner::PostNonNestableDelayedTask( |
28 const tracked_objects::Location& from_here, | 29 const tracked_objects::Location& from_here, |
29 const base::Closure& task, | 30 base::Closure task, |
30 base::TimeDelta delay) { | 31 base::TimeDelta delay) { |
31 CHECK(task_runner_->PostNonNestableDelayedTask(from_here, task, delay)); | 32 CHECK(task_runner_->PostNonNestableDelayedTask(from_here, std::move(task), |
| 33 delay)); |
32 return true; | 34 return true; |
33 } | 35 } |
34 | 36 |
35 bool AutoThreadTaskRunner::RunsTasksOnCurrentThread() const { | 37 bool AutoThreadTaskRunner::RunsTasksOnCurrentThread() const { |
36 return task_runner_->RunsTasksOnCurrentThread(); | 38 return task_runner_->RunsTasksOnCurrentThread(); |
37 } | 39 } |
38 | 40 |
39 AutoThreadTaskRunner::~AutoThreadTaskRunner() { | 41 AutoThreadTaskRunner::~AutoThreadTaskRunner() { |
40 CHECK(task_runner_->PostTask(FROM_HERE, stop_task_)); | 42 CHECK(task_runner_->PostTask(FROM_HERE, std::move(stop_task_))); |
41 } | 43 } |
42 | 44 |
43 } // namespace remoting | 45 } // namespace remoting |
OLD | NEW |