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

Unified Diff: base/serial_executor.h

Issue 9169037: Make new TaskRunner, SequencedTaskRunner, and SingleThreadTaskRunner interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« base/executor_helpers.h ('K') | « base/message_loop_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/serial_executor.h
diff --git a/base/serial_executor.h b/base/serial_executor.h
new file mode 100644
index 0000000000000000000000000000000000000000..cafccd2475c70190fc364d55d5c945f2bb63b2e4
--- /dev/null
+++ b/base/serial_executor.h
@@ -0,0 +1,32 @@
+// 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.
+
+#ifndef BASE_SERIAL_EXECUTOR_H_
+#define BASE_SERIAL_EXECUTOR_H_
+#pragma once
+
+#include "base/base_export.h"
+#include "base/executor.h"
+
+namespace base {
+
+// A SerialExecutor is an Executor with more guarantees. In
+// particular, it guarantees that all submitted tasks, if executed,
+// will be executed on a single specific thread. Furthermore, it
darin (slow to review) 2012/01/25 07:25:56 It wasn't clear to me that we needed this interfac
+// guarantees that tasks with the same delay and same nestable state
+// (i.e., whether the task was posted via Post*Task or
+// PostNonNestable*Task) get processed in FIFO order, with Post*Task
+// being equivalent to Post*DelayedTask with zero delay.
+class BASE_EXPORT SerialExecutor : public Executor {
+ public:
+ // Returns true iff the current thread is the thread which tasks
+ // submitted to this object will run on.
+ //
+ // TODO(akalin): Make this a const function.
+ virtual bool BelongsToCurrentThread() = 0;
+};
+
+} // namespace base
+
+#endif // BASE_SERIAL_EXECUTOR_H_
« base/executor_helpers.h ('K') | « base/message_loop_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698