| 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 12 matching lines...) Expand all Loading... |
| 23 return true; | 23 return true; |
| 24 } | 24 } |
| 25 | 25 |
| 26 const TaskTraits traits_; | 26 const TaskTraits traits_; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 void PostTask(const tracked_objects::Location& from_here, const Closure& task) { | 32 void PostTask(const tracked_objects::Location& from_here, const Closure& task) { |
| 33 PostTaskWithTraits(from_here, TaskTraits(), task); | 33 PostDelayedTask(from_here, task, TimeDelta()); |
| 34 } |
| 35 |
| 36 void PostDelayedTask(const tracked_objects::Location& from_here, |
| 37 const Closure& task, |
| 38 TimeDelta delay) { |
| 39 PostDelayedTaskWithTraits(from_here, TaskTraits(), task, delay); |
| 34 } | 40 } |
| 35 | 41 |
| 36 void PostTaskAndReply(const tracked_objects::Location& from_here, | 42 void PostTaskAndReply(const tracked_objects::Location& from_here, |
| 37 const Closure& task, | 43 const Closure& task, |
| 38 const Closure& reply) { | 44 const Closure& reply) { |
| 39 PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply); | 45 PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply); |
| 40 } | 46 } |
| 41 | 47 |
| 42 void PostTaskWithTraits(const tracked_objects::Location& from_here, | 48 void PostTaskWithTraits(const tracked_objects::Location& from_here, |
| 43 const TaskTraits& traits, | 49 const TaskTraits& traits, |
| 44 const Closure& task) { | 50 const Closure& task) { |
| 45 TaskScheduler::GetInstance()->PostTaskWithTraits(from_here, traits, task); | 51 PostDelayedTaskWithTraits(from_here, traits, task, TimeDelta()); |
| 52 } |
| 53 |
| 54 void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here, |
| 55 const TaskTraits& traits, |
| 56 const Closure& task, |
| 57 TimeDelta delay) { |
| 58 TaskScheduler::GetInstance()->PostDelayedTaskWithTraits(from_here, traits, |
| 59 task, delay); |
| 46 } | 60 } |
| 47 | 61 |
| 48 void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here, | 62 void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here, |
| 49 const TaskTraits& traits, | 63 const TaskTraits& traits, |
| 50 const Closure& task, | 64 const Closure& task, |
| 51 const Closure& reply) { | 65 const Closure& reply) { |
| 52 PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(from_here, task, reply); | 66 PostTaskAndReplyTaskRunner(traits).PostTaskAndReply(from_here, task, reply); |
| 53 } | 67 } |
| 54 | 68 |
| 55 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { | 69 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { |
| 56 return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits); | 70 return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits(traits); |
| 57 } | 71 } |
| 58 | 72 |
| 59 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( | 73 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
| 60 const TaskTraits& traits) { | 74 const TaskTraits& traits) { |
| 61 return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits( | 75 return TaskScheduler::GetInstance()->CreateSequencedTaskRunnerWithTraits( |
| 62 traits); | 76 traits); |
| 63 } | 77 } |
| 64 | 78 |
| 65 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( | 79 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( |
| 66 const TaskTraits& traits) { | 80 const TaskTraits& traits) { |
| 67 return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits( | 81 return TaskScheduler::GetInstance()->CreateSingleThreadTaskRunnerWithTraits( |
| 68 traits); | 82 traits); |
| 69 } | 83 } |
| 70 | 84 |
| 71 } // namespace base | 85 } // namespace base |
| OLD | NEW |