OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ | 5 #ifndef COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ |
6 #define COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ | 6 #define COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/trace_event/trace_event.h" | |
11 #include "components/scheduler/scheduler_export.h" | 12 #include "components/scheduler/scheduler_export.h" |
12 | 13 |
14 namespace base { | |
15 namespace trace_event { | |
16 class BlameContext; | |
17 } | |
18 } | |
19 | |
13 namespace scheduler { | 20 namespace scheduler { |
14 class TimeDomain; | 21 class TimeDomain; |
15 | 22 |
16 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { | 23 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
17 public: | 24 public: |
18 TaskQueue() {} | 25 TaskQueue() {} |
19 | 26 |
20 // Unregisters the task queue after which no tasks posted to it will run and | 27 // Unregisters the task queue after which no tasks posted to it will run and |
21 // the TaskQueueManager's reference to it will be released soon. | 28 // the TaskQueueManager's reference to it will be released soon. |
22 virtual void UnregisterTaskQueue() = 0; | 29 virtual void UnregisterTaskQueue() = 0; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 // |may_post_dowork|. | 184 // |may_post_dowork|. |
178 virtual void PumpQueue(bool may_post_dowork) = 0; | 185 virtual void PumpQueue(bool may_post_dowork) = 0; |
179 | 186 |
180 // These functions can only be called on the same thread that the task queue | 187 // These functions can only be called on the same thread that the task queue |
181 // manager executes its tasks on. | 188 // manager executes its tasks on. |
182 virtual void AddTaskObserver( | 189 virtual void AddTaskObserver( |
183 base::MessageLoop::TaskObserver* task_observer) = 0; | 190 base::MessageLoop::TaskObserver* task_observer) = 0; |
184 virtual void RemoveTaskObserver( | 191 virtual void RemoveTaskObserver( |
185 base::MessageLoop::TaskObserver* task_observer) = 0; | 192 base::MessageLoop::TaskObserver* task_observer) = 0; |
186 | 193 |
194 // Set the blame context which is entered and left while executing tasks from | |
195 // this task queue. |blame_context| must be null or outlive this task queue. | |
alex clarke (OOO till 29th)
2016/03/21 14:38:36
Please mention this is main thread only.
Sami
2016/03/21 15:18:05
Done.
| |
196 virtual void SetBlameContext( | |
197 base::trace_event::BlameContext* blame_context) = 0; | |
198 | |
187 // Removes the task queue from the previous TimeDomain and adds it to | 199 // Removes the task queue from the previous TimeDomain and adds it to |
188 // |domain|. This is a moderately expensive operation. | 200 // |domain|. This is a moderately expensive operation. |
189 virtual void SetTimeDomain(TimeDomain* domain) = 0; | 201 virtual void SetTimeDomain(TimeDomain* domain) = 0; |
190 | 202 |
191 // Returns the queue's current TimeDomain. Can be called from any thread. | 203 // Returns the queue's current TimeDomain. Can be called from any thread. |
192 virtual TimeDomain* GetTimeDomain() const = 0; | 204 virtual TimeDomain* GetTimeDomain() const = 0; |
193 | 205 |
194 protected: | 206 protected: |
195 ~TaskQueue() override {} | 207 ~TaskQueue() override {} |
196 | 208 |
197 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 209 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
198 }; | 210 }; |
199 | 211 |
200 } // namespace scheduler | 212 } // namespace scheduler |
201 | 213 |
202 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ | 214 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ |
OLD | NEW |