| Index: base/threading/thread_task_runner_handle.h
|
| diff --git a/base/threading/thread_task_runner_handle.h b/base/threading/thread_task_runner_handle.h
|
| index c8e58935f0977259349857bf91d71c63bf734567..7e389fb9a49df9ba6b607bd8da59e927960912a1 100644
|
| --- a/base/threading/thread_task_runner_handle.h
|
| +++ b/base/threading/thread_task_runner_handle.h
|
| @@ -9,31 +9,34 @@
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/single_thread_task_runner.h"
|
| +#include "base/threading/task_runner_handle.h"
|
|
|
| namespace base {
|
|
|
| -// ThreadTaskRunnerHandle stores a reference to a thread's TaskRunner
|
| -// in thread-local storage. Callers can then retrieve the TaskRunner
|
| -// for the current thread by calling ThreadTaskRunnerHandle::Get().
|
| -// At most one TaskRunner may be bound to each thread at a time.
|
| -// Prefer SequenceTaskRunnerHandle to this unless thread affinity is required.
|
| +// Deprecated, see below for specifics.
|
| class BASE_EXPORT ThreadTaskRunnerHandle {
|
| public:
|
| - // Gets the SingleThreadTaskRunner for the current thread.
|
| - static scoped_refptr<SingleThreadTaskRunner> Get();
|
| -
|
| - // Returns true if the SingleThreadTaskRunner is already created for
|
| - // the current thread.
|
| - static bool IsSet();
|
| -
|
| - // Binds |task_runner| to the current thread. |task_runner| must belong
|
| - // to the current thread for this to succeed.
|
| + // Deprecated, use TaskRunnerHandle::Get.*() instead.
|
| + // Note: There will not be an automated ThreadTaskRunnerHandle::Get() =>
|
| + // TaskRunnerHandle::GetSingleThreaded() change. ThreadTaskRunnerHandle::Get()
|
| + // callsites should instead be examined one-by-one and given the right
|
| + // semantics for their use case (i.e. don't use GetSingleThreaded() unless
|
| + // truly thread-affine).
|
| + static scoped_refptr<SingleThreadTaskRunner> Get() {
|
| + return TaskRunnerHandle::GetSingleThreaded();
|
| + }
|
| +
|
| + // Deprecated, use TaskRunnerHandle::HasSingleThreadTaskScope() instead.
|
| + static bool IsSet() { return TaskRunnerHandle::HasSingleThreadTaskScope(); }
|
| +
|
| + // Binds |task_runner| to the current thread. Deprecated, use
|
| + // TaskRunnerHandle::SingleThreadTaskScope instead.
|
| explicit ThreadTaskRunnerHandle(
|
| scoped_refptr<SingleThreadTaskRunner> task_runner);
|
| ~ThreadTaskRunnerHandle();
|
|
|
| private:
|
| - scoped_refptr<SingleThreadTaskRunner> task_runner_;
|
| + TaskRunnerHandle::SingleThreadTaskScope task_scope_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ThreadTaskRunnerHandle);
|
| };
|
|
|