| 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_CHILD_TASK_QUEUE_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_H_ |
| 6 #define COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_H_ |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" |
| 8 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 9 #include "components/scheduler/scheduler_export.h" | 10 #include "components/scheduler/scheduler_export.h" |
| 10 | 11 |
| 11 namespace scheduler { | 12 namespace scheduler { |
| 12 | 13 |
| 13 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { | 14 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
| 14 public: | 15 public: |
| 15 TaskQueue() {} | 16 TaskQueue() {} |
| 16 | 17 |
| 17 // Unregisters the task queue after which no tasks posted to it will run and | 18 // Unregisters the task queue after which no tasks posted to it will run and |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 // Reloads new tasks from the incoming queue into the work queue, regardless | 160 // Reloads new tasks from the incoming queue into the work queue, regardless |
| 160 // of whether the work queue is empty or not. After this, the function ensures | 161 // of whether the work queue is empty or not. After this, the function ensures |
| 161 // that the tasks in the work queue, if any, are scheduled for execution. | 162 // that the tasks in the work queue, if any, are scheduled for execution. |
| 162 // | 163 // |
| 163 // This function only needs to be called if automatic pumping is disabled. | 164 // This function only needs to be called if automatic pumping is disabled. |
| 164 // By default automatic pumping is enabled for all queues. NOTE this must be | 165 // By default automatic pumping is enabled for all queues. NOTE this must be |
| 165 // called on the thread this TaskQueue was created by. | 166 // called on the thread this TaskQueue was created by. |
| 166 virtual void PumpQueue() = 0; | 167 virtual void PumpQueue() = 0; |
| 167 | 168 |
| 169 // These functions can only be called on the same thread that the task queue |
| 170 // manager executes its tasks on. |
| 171 virtual void AddTaskObserver( |
| 172 base::MessageLoop::TaskObserver* task_observer) = 0; |
| 173 virtual void RemoveTaskObserver( |
| 174 base::MessageLoop::TaskObserver* task_observer) = 0; |
| 175 |
| 168 protected: | 176 protected: |
| 169 ~TaskQueue() override {} | 177 ~TaskQueue() override {} |
| 170 | 178 |
| 171 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 179 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 172 }; | 180 }; |
| 173 | 181 |
| 174 } // namespace scheduler | 182 } // namespace scheduler |
| 175 | 183 |
| 176 #endif // COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_H_ | 184 #endif // COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_H_ |
| OLD | NEW |