OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/task_scheduler/post_task.h" | 5 #include "base/task_scheduler/post_task.h" |
6 | 6 |
7 #include "base/task_scheduler/task_scheduler.h" | 7 #include "base/task_scheduler/task_scheduler.h" |
8 #include "base/threading/post_task_and_reply_impl.h" | 8 #include "base/threading/post_task_and_reply_impl.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 22 matching lines...) Expand all Loading... |
33 PostDelayedTask(from_here, task, TimeDelta()); | 33 PostDelayedTask(from_here, task, TimeDelta()); |
34 } | 34 } |
35 | 35 |
36 void PostDelayedTask(const tracked_objects::Location& from_here, | 36 void PostDelayedTask(const tracked_objects::Location& from_here, |
37 const Closure& task, | 37 const Closure& task, |
38 TimeDelta delay) { | 38 TimeDelta delay) { |
39 PostDelayedTaskWithTraits(from_here, TaskTraits(), task, delay); | 39 PostDelayedTaskWithTraits(from_here, TaskTraits(), task, delay); |
40 } | 40 } |
41 | 41 |
42 void PostTaskAndReply(const tracked_objects::Location& from_here, | 42 void PostTaskAndReply(const tracked_objects::Location& from_here, |
43 const Closure& task, | 43 Closure task, |
44 const Closure& reply) { | 44 Closure reply) { |
45 PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply); | 45 PostTaskWithTraitsAndReply(from_here, TaskTraits(), std::move(task), |
| 46 std::move(reply)); |
46 } | 47 } |
47 | 48 |
48 void PostTaskWithTraits(const tracked_objects::Location& from_here, | 49 void PostTaskWithTraits(const tracked_objects::Location& from_here, |
49 const TaskTraits& traits, | 50 const TaskTraits& traits, |
50 const Closure& task) { | 51 const Closure& task) { |
51 PostDelayedTaskWithTraits(from_here, traits, task, TimeDelta()); | 52 PostDelayedTaskWithTraits(from_here, traits, task, TimeDelta()); |
52 } | 53 } |
53 | 54 |
54 void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here, | 55 void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here, |
55 const TaskTraits& traits, | 56 const TaskTraits& traits, |
56 const Closure& task, | 57 const Closure& task, |
57 TimeDelta delay) { | 58 TimeDelta delay) { |
58 TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits, | 59 TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits, |
59 task, delay); | 60 task, delay); |
60 } | 61 } |
61 | 62 |
62 void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here, | 63 void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here, |
63 const TaskTraits& traits, | 64 const TaskTraits& traits, |
64 const Closure& task, | 65 Closure task, |
65 const Closure& reply) { | 66 Closure reply) { |
66 PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(from_here, task, reply); | 67 PostTaskAndReplyTaskRunner(traits).PostTaskAndReply( |
| 68 from_here, std::move(task), std::move(reply)); |
67 } | 69 } |
68 | 70 |
69 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { | 71 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { |
70 return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits); | 72 return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits); |
71 } | 73 } |
72 | 74 |
73 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( | 75 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
74 const TaskTraits& traits) { | 76 const TaskTraits& traits) { |
75 return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits( | 77 return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits( |
76 traits); | 78 traits); |
77 } | 79 } |
78 | 80 |
79 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( | 81 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( |
80 const TaskTraits& traits) { | 82 const TaskTraits& traits) { |
81 return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits( | 83 return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits( |
82 traits); | 84 traits); |
83 } | 85 } |
84 | 86 |
85 } // namespace base | 87 } // namespace base |
OLD | NEW |