Chromium Code Reviews| Index: base/task_scheduler/post_task.cc |
| diff --git a/base/task_scheduler/post_task.cc b/base/task_scheduler/post_task.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..38f528c8e5bf19bad4494d2892ee122c566a72c9 |
| --- /dev/null |
| +++ b/base/task_scheduler/post_task.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/task_scheduler/post_task.h" |
| + |
| +#include "base/logging.h" |
| +#include "base/task_scheduler/task_scheduler.h" |
| + |
| +namespace base { |
| + |
| +void PostTask(const tracked_objects::Location& from_here, const Closure& task) { |
| + PostTaskWithTraits(from_here, TaskTraits(), task); |
| +} |
| + |
| +void PostTaskAndReply(const tracked_objects::Location& from_here, |
| + const Closure& task, |
| + const Closure& reply) { |
| + PostTaskWithTraitsAndReply(from_here, TaskTraits(), task, reply); |
| +} |
| + |
| +void PostTaskWithTraits(const tracked_objects::Location& from_here, |
| + TaskTraits traits, |
| + const Closure& task) { |
| + DCHECK(TaskScheduler::GetInstance()); |
|
robliao
2016/02/11 22:49:30
Remove DCHECK and the one in CreateTaskRunnerWithT
fdoray
2016/02/12 04:16:19
Done.
|
| + TaskScheduler::GetInstance()->PostTaskWithTraits(from_here, traits, task); |
| +} |
| + |
| +void PostTaskWithTraitsAndReply(const tracked_objects::Location& from_here, |
| + TaskTraits traits, |
| + const Closure& task, |
| + const Closure& reply) { |
| + // TODO: Post and reply wrapper. |
| + NOTIMPLEMENTED(); |
| +} |
| + |
| +scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
| + TaskTraits traits, |
| + ExecutionMode execution_mode) { |
| + DCHECK(TaskScheduler::GetInstance()); |
| + return TaskScheduler::GetInstance()->CreateTaskRunnerWithTraits( |
| + traits, execution_mode); |
| +} |
| + |
| +} // namespace base |