Index: base/executor.cc |
diff --git a/base/executor.cc b/base/executor.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..62359b69353b24b6e16d68727df88d2c03221a91 |
--- /dev/null |
+++ b/base/executor.cc |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 2012 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/executor.h" |
+ |
+#include "base/bind.h" |
+#include "base/compiler_specific.h" |
+#include "base/threading/post_task_and_reply_impl.h" |
+ |
+namespace base { |
+ |
+namespace { |
+ |
+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
|
+ public: |
+ PostTaskAndReplyExecutor(Executor* destination); |
+ |
+ private: |
+ virtual bool PostTask(const tracked_objects::Location& from_here, |
+ const Closure& task) OVERRIDE; |
+ |
+ // Non-owning. |
+ Executor* destination_; |
+}; |
+ |
+PostTaskAndReplyExecutor::PostTaskAndReplyExecutor( |
+ Executor* destination) : destination_(destination) {} |
+ |
+bool PostTaskAndReplyExecutor::PostTask( |
+ const tracked_objects::Location& from_here, |
+ const Closure& task) { |
+ return destination_->PostTask(from_here, task); |
+} |
+ |
+} // namespace |
+ |
+bool Executor::PostTaskAndReply( |
+ const tracked_objects::Location& from_here, |
+ const Closure& task, |
+ const Closure& reply) { |
+ return PostTaskAndReplyExecutor(this).PostTaskAndReply( |
+ from_here, task, reply); |
+} |
+ |
+Executor::Executor() {} |
+ |
+Executor::~Executor() {} |
+ |
+void Executor::OnDestruct() const { |
+ delete this; |
+} |
+ |
+void ExecutorTraits::Destruct(const Executor* executor) { |
+ executor->OnDestruct(); |
+} |
+ |
+bool Executor::DeleteSoonInternal( |
+ const tracked_objects::Location& from_here, |
+ void(*deleter)(const void*), |
+ const void* object) { |
+ return PostNonNestableTask(from_here, Bind(deleter, object)); |
+} |
+ |
+bool Executor::ReleaseSoonInternal( |
+ const tracked_objects::Location& from_here, |
+ void(*releaser)(const void*), |
+ const void* object) { |
+ return PostNonNestableTask(from_here, Bind(releaser, object)); |
+} |
+ |
+} // namespace base |