Roll src/third_party/WebKit 640e652:eec14d5 (svn 200948:200949)
[chromium-blink-merge.git] / base / threading / post_task_and_reply_impl.h
blobd21ab78de85501e4cd7dd8cf66d0e02e8176dc5f
1 // Copyright (c) 2011 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 // This file contains the implementation shared by
6 // TaskRunner::PostTaskAndReply and WorkerPool::PostTaskAndReply.
8 #ifndef BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_
9 #define BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_
11 #include "base/callback_forward.h"
12 #include "base/location.h"
14 namespace base {
15 namespace internal {
17 // Inherit from this in a class that implements PostTask appropriately
18 // for sending to a destination thread.
20 // Note that 'reply' will always get posted back to your current
21 // MessageLoop.
23 // If you're looking for a concrete implementation of
24 // PostTaskAndReply, you probably want base::SingleThreadTaskRunner, or you
25 // may want base::WorkerPool.
26 class PostTaskAndReplyImpl {
27 public:
28 virtual ~PostTaskAndReplyImpl() = default;
30 // Implementation for TaskRunner::PostTaskAndReply and
31 // WorkerPool::PostTaskAndReply.
32 bool PostTaskAndReply(const tracked_objects::Location& from_here,
33 const Closure& task,
34 const Closure& reply);
36 private:
37 virtual bool PostTask(const tracked_objects::Location& from_here,
38 const Closure& task) = 0;
41 } // namespace internal
42 } // namespace base
44 #endif // BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_