| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "components/scheduler/scheduler_export.h" | 10 #include "components/scheduler/scheduler_export.h" |
| 11 | 11 |
| 12 namespace scheduler { | 12 namespace scheduler { |
| 13 | 13 |
| 14 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { | 14 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { |
| 15 public: | 15 public: |
| 16 TaskQueue() {} | 16 TaskQueue() {} |
| 17 | 17 |
| 18 // 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 |
| 19 // the TaskQueueManager's reference to it will be released soon. | 19 // the TaskQueueManager's reference to it will be released soon. |
| 20 virtual void UnregisterTaskQueue() = 0; | 20 virtual void UnregisterTaskQueue() = 0; |
| 21 | 21 |
| 22 // Post a delayed task at an absolute desired run time instead of a time | |
| 23 // delta from the current time. | |
| 24 virtual bool PostDelayedTaskAt(const tracked_objects::Location& from_here, | |
| 25 const base::Closure& task, | |
| 26 base::TimeTicks desired_run_time) = 0; | |
| 27 | |
| 28 enum QueuePriority { | 22 enum QueuePriority { |
| 29 // Queues with control priority will run before any other queue, and will | 23 // Queues with control priority will run before any other queue, and will |
| 30 // explicitly starve other queues. Typically this should only be used for | 24 // explicitly starve other queues. Typically this should only be used for |
| 31 // private queues which perform control operations. | 25 // private queues which perform control operations. |
| 32 CONTROL_PRIORITY, | 26 CONTROL_PRIORITY, |
| 33 // Queues with high priority will be selected preferentially over normal or | 27 // Queues with high priority will be selected preferentially over normal or |
| 34 // best effort queues. The selector will ensure that high priority queues | 28 // best effort queues. The selector will ensure that high priority queues |
| 35 // cannot completely starve normal priority queues. | 29 // cannot completely starve normal priority queues. |
| 36 HIGH_PRIORITY, | 30 HIGH_PRIORITY, |
| 37 // Queues with normal priority are the default. | 31 // Queues with normal priority are the default. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 169 |
| 176 protected: | 170 protected: |
| 177 ~TaskQueue() override {} | 171 ~TaskQueue() override {} |
| 178 | 172 |
| 179 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 173 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 180 }; | 174 }; |
| 181 | 175 |
| 182 } // namespace scheduler | 176 } // namespace scheduler |
| 183 | 177 |
| 184 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ | 178 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |