| Index: base/threading/task_runner_handle_internal.h
|
| diff --git a/base/threading/task_runner_handle_internal.h b/base/threading/task_runner_handle_internal.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c26b14e2596523a1d96ca3c3dfb1a6256fc95bab
|
| --- /dev/null
|
| +++ b/base/threading/task_runner_handle_internal.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2016 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_THREADING_TASK_RUNNER_HANDLE_INTERNAL_H_
|
| +#define BASE_THREADING_TASK_RUNNER_HANDLE_INTERNAL_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +
|
| +namespace base {
|
| +
|
| +class SequencedTaskRunner;
|
| +class SingleThreadTaskRunner;
|
| +class TaskRunner;
|
| +
|
| +namespace internal {
|
| +
|
| +// Holds the state associated with one of the TaskScope variants. Stores the
|
| +// relevant pointer in a generic TaskRunner pointer and remembers the type
|
| +// through an enum which makes for fast lookup of which levels of TaskRunners
|
| +// are available.
|
| +struct TaskScopeState {
|
| + TaskScopeState(scoped_refptr<TaskRunner> task_runner);
|
| + TaskScopeState(scoped_refptr<SequencedTaskRunner> sequenced_task_runner);
|
| + TaskScopeState(
|
| + scoped_refptr<SingleThreadTaskRunner> single_thread_task_runner);
|
| +
|
| + ~TaskScopeState();
|
| +
|
| + // TaskScope types sorted from least restrictive to most restrictive. Order
|
| + // is used for quick lookup of available TaskScope type on current thread.
|
| + enum Type { PARALLEL, SEQUENCED, SINGLE_THREADED };
|
| +
|
| + const Type type;
|
| +
|
| + // A generic TaskRunner to store the potentially more specific TaskRunner
|
| + // which can safely be upcasted if |type| allows.
|
| + const scoped_refptr<TaskRunner> task_runner;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(TaskScopeState);
|
| +};
|
| +
|
| +} // namespace internal
|
| +} // namespace base
|
| +
|
| +#endif // BASE_THREADING_TASK_RUNNER_HANDLE_INTERNAL_H_
|
|
|