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 THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 6 #define THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_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/optional.h" | 10 #include "base/optional.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Returns true if the queue is completely empty. | 143 // Returns true if the queue is completely empty. |
144 virtual bool IsEmpty() const = 0; | 144 virtual bool IsEmpty() const = 0; |
145 | 145 |
146 // Returns the number of pending tasks in the queue. | 146 // Returns the number of pending tasks in the queue. |
147 virtual size_t GetNumberOfPendingTasks() const = 0; | 147 virtual size_t GetNumberOfPendingTasks() const = 0; |
148 | 148 |
149 // Returns true if the queue has work that's ready to execute now. | 149 // Returns true if the queue has work that's ready to execute now. |
150 // NOTE: this must be called on the thread this TaskQueue was created by. | 150 // NOTE: this must be called on the thread this TaskQueue was created by. |
151 virtual bool HasPendingImmediateWork() const = 0; | 151 virtual bool HasPendingImmediateWork() const = 0; |
152 | 152 |
153 // Returns requested run time of next delayed task, which is not ready | 153 // Returns requested run time of next scheduled wakeup for a delayed task |
154 // to run. If there are no such tasks, returns base::nullopt. | 154 // which is not ready to run. If there are no such tasks or the queue is |
| 155 // disabled (by a QueueEnabledVoter) it returns base::nullopt. |
155 // NOTE: this must be called on the thread this TaskQueue was created by. | 156 // NOTE: this must be called on the thread this TaskQueue was created by. |
156 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; | 157 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; |
157 | 158 |
158 // Can be called on any thread. | 159 // Can be called on any thread. |
159 virtual QueueType GetQueueType() const = 0; | 160 virtual QueueType GetQueueType() const = 0; |
160 | 161 |
161 // Can be called on any thread. | 162 // Can be called on any thread. |
162 virtual const char* GetName() const = 0; | 163 virtual const char* GetName() const = 0; |
163 | 164 |
164 // Set the priority of the queue to |priority|. NOTE this must be called on | 165 // Set the priority of the queue to |priority|. NOTE this must be called on |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 protected: | 211 protected: |
211 ~TaskQueue() override {} | 212 ~TaskQueue() override {} |
212 | 213 |
213 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 214 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
214 }; | 215 }; |
215 | 216 |
216 } // namespace scheduler | 217 } // namespace scheduler |
217 } // namespace blink | 218 } // namespace blink |
218 | 219 |
219 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 220 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
OLD | NEW |