OLD | NEW |
---|---|
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_SINGLE_THREAD_TASK_RUNNER_H_ | 5 #ifndef BASE_SINGLE_THREAD_TASK_RUNNER_H_ |
6 #define BASE_SINGLE_THREAD_TASK_RUNNER_H_ | 6 #define BASE_SINGLE_THREAD_TASK_RUNNER_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 // - Add tasks to a FIFO and signal to a non-MessageLoop thread for them to | 22 // - Add tasks to a FIFO and signal to a non-MessageLoop thread for them to |
23 // be processed. This allows TaskRunner-oriented code run on threads | 23 // be processed. This allows TaskRunner-oriented code run on threads |
24 // running other kinds of message loop, e.g. Jingle threads. | 24 // running other kinds of message loop, e.g. Jingle threads. |
25 class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner { | 25 class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner { |
26 public: | 26 public: |
27 // A more explicit alias to RunsTasksOnCurrentThread(). | 27 // A more explicit alias to RunsTasksOnCurrentThread(). |
28 bool BelongsToCurrentThread() const { | 28 bool BelongsToCurrentThread() const { |
29 return RunsTasksOnCurrentThread(); | 29 return RunsTasksOnCurrentThread(); |
30 } | 30 } |
31 | 31 |
32 // Returns the name of the thread this TaskRunner is associated with. | |
33 virtual const char* GetThreadName() const = 0; | |
jam
2016/05/06 16:50:23
premature optimization to return const char* inste
alokp
2016/05/07 04:14:05
Done.
| |
34 | |
32 protected: | 35 protected: |
33 ~SingleThreadTaskRunner() override {} | 36 ~SingleThreadTaskRunner() override {} |
34 }; | 37 }; |
35 | 38 |
36 } // namespace base | 39 } // namespace base |
37 | 40 |
38 #endif // BASE_SINGLE_THREAD_TASK_RUNNER_H_ | 41 #endif // BASE_SINGLE_THREAD_TASK_RUNNER_H_ |
OLD | NEW |