Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: base/executor.cc

Issue 9169037: Make new TaskRunner, SequencedTaskRunner, and SingleThreadTaskRunner interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "base/executor.h"
6
7 #include "base/bind.h"
8 #include "base/compiler_specific.h"
9 #include "base/threading/post_task_and_reply_impl.h"
10
11 namespace base {
12
13 namespace {
14
15 class PostTaskAndReplyExecutor : public internal::PostTaskAndReplyImpl {
willchan no longer on Chromium 2012/02/01 10:34:11 The plan is to get rid of internal::PostTaskAndRep
16 public:
17 PostTaskAndReplyExecutor(Executor* destination);
18
19 private:
20 virtual bool PostTask(const tracked_objects::Location& from_here,
21 const Closure& task) OVERRIDE;
22
23 // Non-owning.
24 Executor* destination_;
25 };
26
27 PostTaskAndReplyExecutor::PostTaskAndReplyExecutor(
28 Executor* destination) : destination_(destination) {}
29
30 bool PostTaskAndReplyExecutor::PostTask(
31 const tracked_objects::Location& from_here,
32 const Closure& task) {
33 return destination_->PostTask(from_here, task);
34 }
35
36 } // namespace
37
38 bool Executor::PostTaskAndReply(
39 const tracked_objects::Location& from_here,
40 const Closure& task,
41 const Closure& reply) {
42 return PostTaskAndReplyExecutor(this).PostTaskAndReply(
43 from_here, task, reply);
44 }
45
46 Executor::Executor() {}
47
48 Executor::~Executor() {}
49
50 void Executor::OnDestruct() const {
51 delete this;
52 }
53
54 void ExecutorTraits::Destruct(const Executor* executor) {
55 executor->OnDestruct();
56 }
57
58 bool Executor::DeleteSoonInternal(
59 const tracked_objects::Location& from_here,
60 void(*deleter)(const void*),
61 const void* object) {
62 return PostNonNestableTask(from_here, Bind(deleter, object));
63 }
64
65 bool Executor::ReleaseSoonInternal(
66 const tracked_objects::Location& from_here,
67 void(*releaser)(const void*),
68 const void* object) {
69 return PostNonNestableTask(from_here, Bind(releaser, object));
70 }
71
72 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698