| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Enable or disable task execution for this queue. NOTE this must be called | 96 // Enable or disable task execution for this queue. NOTE this must be called |
| 97 // on the thread this TaskQueue was created by. | 97 // on the thread this TaskQueue was created by. |
| 98 virtual void SetQueueEnabled(bool enabled) = 0; | 98 virtual void SetQueueEnabled(bool enabled) = 0; |
| 99 | 99 |
| 100 // NOTE this must be called on the thread this TaskQueue was created by. | 100 // NOTE this must be called on the thread this TaskQueue was created by. |
| 101 virtual bool IsQueueEnabled() const = 0; | 101 virtual bool IsQueueEnabled() const = 0; |
| 102 | 102 |
| 103 // Returns true if the queue is completely empty. | 103 // Returns true if the queue is completely empty. |
| 104 virtual bool IsEmpty() const = 0; | 104 virtual bool IsEmpty() const = 0; |
| 105 | 105 |
| 106 // Returns the number of pending tasks in the queue. |
| 107 virtual size_t GetNumberOfPendingTasks() const = 0; |
| 108 |
| 106 // Returns true if the queue has work that's ready to execute now. | 109 // Returns true if the queue has work that's ready to execute now. |
| 107 // NOTE: this must be called on the thread this TaskQueue was created by. | 110 // NOTE: this must be called on the thread this TaskQueue was created by. |
| 108 virtual bool HasPendingImmediateWork() const = 0; | 111 virtual bool HasPendingImmediateWork() const = 0; |
| 109 | 112 |
| 110 // Returns requested run time of next delayed task, which is not ready | 113 // Returns requested run time of next delayed task, which is not ready |
| 111 // to run. If there are no such tasks, returns base::nullopt. | 114 // to run. If there are no such tasks, returns base::nullopt. |
| 112 // NOTE: this must be called on the thread this TaskQueue was created by. | 115 // NOTE: this must be called on the thread this TaskQueue was created by. |
| 113 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; | 116 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; |
| 114 | 117 |
| 115 // Can be called on any thread. | 118 // Can be called on any thread. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 protected: | 161 protected: |
| 159 ~TaskQueue() override {} | 162 ~TaskQueue() override {} |
| 160 | 163 |
| 161 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 164 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 162 }; | 165 }; |
| 163 | 166 |
| 164 } // namespace scheduler | 167 } // namespace scheduler |
| 165 } // namespace blink | 168 } // namespace blink |
| 166 | 169 |
| 167 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 170 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |