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
3 // found in the LICENSE file.
5 #include "base/task_runner.h"
7 #include "base/compiler_specific.h"
8 #include "base/logging.h"
9 #include "base/threading/post_task_and_reply_impl.h"
15 // TODO(akalin): There's only one other implementation of
16 // PostTaskAndReplyImpl in WorkerPool. Investigate whether it'll be
17 // possible to merge the two.
18 class PostTaskAndReplyTaskRunner
: public internal::PostTaskAndReplyImpl
{
20 explicit PostTaskAndReplyTaskRunner(TaskRunner
* destination
);
23 bool PostTask(const tracked_objects::Location
& from_here
,
24 const Closure
& task
) override
;
27 TaskRunner
* destination_
;
30 PostTaskAndReplyTaskRunner::PostTaskAndReplyTaskRunner(
31 TaskRunner
* destination
) : destination_(destination
) {
35 bool PostTaskAndReplyTaskRunner::PostTask(
36 const tracked_objects::Location
& from_here
,
37 const Closure
& task
) {
38 return destination_
->PostTask(from_here
, task
);
43 bool TaskRunner::PostTask(const tracked_objects::Location
& from_here
,
44 const Closure
& task
) {
45 return PostDelayedTask(from_here
, task
, base::TimeDelta());
48 bool TaskRunner::PostTaskAndReply(
49 const tracked_objects::Location
& from_here
,
51 const Closure
& reply
) {
52 return PostTaskAndReplyTaskRunner(this).PostTaskAndReply(
53 from_here
, task
, reply
);
56 TaskRunner::TaskRunner() {}
58 TaskRunner::~TaskRunner() {}
60 void TaskRunner::OnDestruct() const {
64 void TaskRunnerTraits::Destruct(const TaskRunner
* task_runner
) {
65 task_runner
->OnDestruct();