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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698