Chromium Code Reviews| 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_ |