OLD | NEW |
---|---|
(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 #ifndef BASE_SERIAL_EXECUTOR_H_ | |
6 #define BASE_SERIAL_EXECUTOR_H_ | |
7 #pragma once | |
8 | |
9 #include "base/base_export.h" | |
10 #include "base/executor.h" | |
11 | |
12 namespace base { | |
13 | |
14 // A SerialExecutor is an Executor with more guarantees. In | |
15 // particular, it guarantees that all submitted tasks, if executed, | |
16 // 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
| |
17 // guarantees that tasks with the same delay and same nestable state | |
18 // (i.e., whether the task was posted via Post*Task or | |
19 // PostNonNestable*Task) get processed in FIFO order, with Post*Task | |
20 // being equivalent to Post*DelayedTask with zero delay. | |
21 class BASE_EXPORT SerialExecutor : public Executor { | |
22 public: | |
23 // Returns true iff the current thread is the thread which tasks | |
24 // submitted to this object will run on. | |
25 // | |
26 // TODO(akalin): Make this a const function. | |
27 virtual bool BelongsToCurrentThread() = 0; | |
28 }; | |
29 | |
30 } // namespace base | |
31 | |
32 #endif // BASE_SERIAL_EXECUTOR_H_ | |
OLD | NEW |