Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: base/thread_task_runner_handle.h

Issue 1966733002: Move base/thread_task_runner_handle.h to base/threading/thread_task_runner_handle.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update include of .cc to be direct Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/base.gypi ('k') | base/thread_task_runner_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_THREAD_TASK_RUNNER_HANDLE_H_ 5 #ifndef BASE_THREAD_TASK_RUNNER_HANDLE_H_
6 #define BASE_THREAD_TASK_RUNNER_HANDLE_H_ 6 #define BASE_THREAD_TASK_RUNNER_HANDLE_H_
7 7
8 #include "base/base_export.h" 8 // This header has moved, include the new one directly instead of this one.
9 #include "base/macros.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "base/memory/ref_counted.h"
11
12 namespace base {
13
14 class SingleThreadTaskRunner;
15
16 // ThreadTaskRunnerHandle stores a reference to a thread's TaskRunner
17 // in thread-local storage. Callers can then retrieve the TaskRunner
18 // for the current thread by calling ThreadTaskRunnerHandle::Get().
19 // At most one TaskRunner may be bound to each thread at a time.
20 // Prefer SequenceTaskRunnerHandle to this unless thread affinity is required.
21 class BASE_EXPORT ThreadTaskRunnerHandle {
22 public:
23 // Gets the SingleThreadTaskRunner for the current thread.
24 static scoped_refptr<SingleThreadTaskRunner> Get();
25
26 // Returns true if the SingleThreadTaskRunner is already created for
27 // the current thread.
28 static bool IsSet();
29
30 // Binds |task_runner| to the current thread. |task_runner| must belong
31 // to the current thread for this to succeed.
32 explicit ThreadTaskRunnerHandle(
33 scoped_refptr<SingleThreadTaskRunner> task_runner);
34 ~ThreadTaskRunnerHandle();
35
36 private:
37 scoped_refptr<SingleThreadTaskRunner> task_runner_;
38
39 DISALLOW_COPY_AND_ASSIGN(ThreadTaskRunnerHandle);
40 };
41
42 } // namespace base
43 10
44 #endif // BASE_THREAD_TASK_RUNNER_HANDLE_H_ 11 #endif // BASE_THREAD_TASK_RUNNER_HANDLE_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/thread_task_runner_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698