| 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/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/time/time.h" |
| 11 #include "public/platform/WebCommon.h" | 13 #include "public/platform/WebCommon.h" |
| 12 | 14 |
| 13 namespace base { | 15 namespace base { |
| 14 namespace trace_event { | 16 namespace trace_event { |
| 15 class BlameContext; | 17 class BlameContext; |
| 16 } | 18 } |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace blink { | 21 namespace blink { |
| 20 namespace scheduler { | 22 namespace scheduler { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // 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 |
| 95 // on the thread this TaskQueue was created by. | 97 // on the thread this TaskQueue was created by. |
| 96 virtual void SetQueueEnabled(bool enabled) = 0; | 98 virtual void SetQueueEnabled(bool enabled) = 0; |
| 97 | 99 |
| 98 // 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. |
| 99 virtual bool IsQueueEnabled() const = 0; | 101 virtual bool IsQueueEnabled() const = 0; |
| 100 | 102 |
| 101 // Returns true if the queue is completely empty. | 103 // Returns true if the queue is completely empty. |
| 102 virtual bool IsEmpty() const = 0; | 104 virtual bool IsEmpty() const = 0; |
| 103 | 105 |
| 104 // Returns true if the queue has work that's ready to execute now. NOTE this | 106 // Returns true if the queue has work that's ready to execute now. |
| 105 // must be called on the thread this TaskQueue was created by. | 107 // NOTE: this must be called on the thread this TaskQueue was created by. |
| 106 virtual bool HasPendingImmediateWork() const = 0; | 108 virtual bool HasPendingImmediateWork() const = 0; |
| 107 | 109 |
| 110 // Returns requested run time of next delayed task, which is not ready |
| 111 // 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. |
| 113 virtual base::Optional<base::TimeTicks> GetNextScheduledWakeUp() = 0; |
| 114 |
| 108 // Can be called on any thread. | 115 // Can be called on any thread. |
| 109 virtual const char* GetName() const = 0; | 116 virtual const char* GetName() const = 0; |
| 110 | 117 |
| 111 // Set the priority of the queue to |priority|. NOTE this must be called on | 118 // Set the priority of the queue to |priority|. NOTE this must be called on |
| 112 // the thread this TaskQueue was created by. | 119 // the thread this TaskQueue was created by. |
| 113 virtual void SetQueuePriority(QueuePriority priority) = 0; | 120 virtual void SetQueuePriority(QueuePriority priority) = 0; |
| 114 | 121 |
| 115 // Returns the current queue priority. | 122 // Returns the current queue priority. |
| 116 virtual QueuePriority GetQueuePriority() const = 0; | 123 virtual QueuePriority GetQueuePriority() const = 0; |
| 117 | 124 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 protected: | 158 protected: |
| 152 ~TaskQueue() override {} | 159 ~TaskQueue() override {} |
| 153 | 160 |
| 154 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 161 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 155 }; | 162 }; |
| 156 | 163 |
| 157 } // namespace scheduler | 164 } // namespace scheduler |
| 158 } // namespace blink | 165 } // namespace blink |
| 159 | 166 |
| 160 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 167 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |