| Index: base/single_thread_executor.h
|
| diff --git a/base/single_thread_executor.h b/base/single_thread_executor.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2a63768d9bf3cd6a2461ae9522ca87e5239ed67a
|
| --- /dev/null
|
| +++ b/base/single_thread_executor.h
|
| @@ -0,0 +1,36 @@
|
| +// 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_SINGLE_THREAD_EXECUTOR_H_
|
| +#define BASE_SINGLE_THREAD_EXECUTOR_H_
|
| +#pragma once
|
| +
|
| +#include "base/base_export.h"
|
| +#include "base/serial_executor.h"
|
| +
|
| +namespace base {
|
| +
|
| +// A SingleThreadExecutor is a SerialExecutor with one more guarantee;
|
| +// namely, that all tasks are executed on a single specific thread.
|
| +//
|
| +// Some theoretical implementations of SingleThreadExecutor:
|
| +//
|
| +// - A SingleThreadExecutor that uses a single worker thread to run
|
| +// submitted tasks (i.e., a message loop).
|
| +//
|
| +// - A SingleThreadExecutor that stores the list of submitted tasks
|
| +// and has a method Run() that executes each runnable task in FIFO
|
| +// order that must be run only from the thread the
|
| +// SingleThreadExecutor was created on.
|
| +class BASE_EXPORT SingleThreadExecutor : public SerialExecutor {
|
| +public:
|
| + // A more explicit alias to MayRunTasksOnCurrentThread().
|
| + bool BelongsToCurrentThread() const {
|
| + return MayRunTasksOnCurrentThread();
|
| + }
|
| +};
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // BASE_SERIAL_EXECUTOR_H_
|
|
|