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_SINGLE_THREAD_EXECUTOR_H_ |
| 6 #define BASE_SINGLE_THREAD_EXECUTOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/base_export.h" |
| 10 #include "base/serial_executor.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 // A SingleThreadExecutor is a SerialExecutor with one more guarantee; |
| 15 // namely, that all tasks are executed on a single specific thread. |
| 16 // |
| 17 // Some theoretical implementations of SingleThreadExecutor: |
| 18 // |
| 19 // - A SingleThreadExecutor that uses a single worker thread to run |
| 20 // submitted tasks (i.e., a message loop). |
| 21 // |
| 22 // - A SingleThreadExecutor that stores the list of submitted tasks |
| 23 // and has a method Run() that executes each runnable task in FIFO |
| 24 // order that must be run only from the thread the |
| 25 // SingleThreadExecutor was created on. |
| 26 class BASE_EXPORT SingleThreadExecutor : public SerialExecutor { |
| 27 public: |
| 28 // A more explicit alias to MayRunTasksOnCurrentThread(). |
| 29 bool BelongsToCurrentThread() const { |
| 30 return MayRunTasksOnCurrentThread(); |
| 31 } |
| 32 }; |
| 33 |
| 34 } // namespace base |
| 35 |
| 36 #endif // BASE_SERIAL_EXECUTOR_H_ |
OLD | NEW |