Chromium Code Reviews| 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 72ce49e1bd045bf2f7603ef8afc5844936dffc06..437136b6caba90285004756806df3d22f828af76 100644 |
| --- a/base/threading/thread_task_runner_handle.h |
| +++ b/base/threading/thread_task_runner_handle.h |
| @@ -8,33 +8,35 @@ |
| #include "base/base_export.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/threading/task_runner_handle.h" |
| namespace base { |
| class SingleThreadTaskRunner; |
| -// 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. |
| 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. |
|
robliao
2016/06/09 15:40:18
Similar deprecated class banner here.
gab
2016/06/14 15:38:59
Done.
|
| + // 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); |
| }; |