| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 virtual void SetBlameContext( | 162 virtual void SetBlameContext( |
| 163 base::trace_event::BlameContext* blame_context) = 0; | 163 base::trace_event::BlameContext* blame_context) = 0; |
| 164 | 164 |
| 165 // Removes the task queue from the previous TimeDomain and adds it to | 165 // Removes the task queue from the previous TimeDomain and adds it to |
| 166 // |domain|. This is a moderately expensive operation. | 166 // |domain|. This is a moderately expensive operation. |
| 167 virtual void SetTimeDomain(TimeDomain* domain) = 0; | 167 virtual void SetTimeDomain(TimeDomain* domain) = 0; |
| 168 | 168 |
| 169 // Returns the queue's current TimeDomain. Can be called from any thread. | 169 // Returns the queue's current TimeDomain. Can be called from any thread. |
| 170 virtual TimeDomain* GetTimeDomain() const = 0; | 170 virtual TimeDomain* GetTimeDomain() const = 0; |
| 171 | 171 |
| 172 // Inserts a barrier into the task queue which inhibits non-delayed tasks | 172 enum class InsertFencePosition { |
| 173 // posted after this point, or delayed tasks which are not yet ready to run, | 173 NOW, // Tasks posted on the queue up till this point further may run. |
| 174 // from being executed until the fence is cleared. If a fence already existed | 174 // All further tasks are blocked. |
| 175 // the one supersedes it and previously blocked tasks will now run up until | 175 BEGINNING_OF_TIME, // No tasks posted on this queue may run. |
| 176 // the new fence is hit. | 176 }; |
| 177 virtual void InsertFence() = 0; | 177 |
| 178 // Inserts a barrier into the task queue which prevents tasks with an enqueue |
| 179 // order greater than the fence from running until either the fence has been |
| 180 // removed or a subsequent fence has unblocked some tasks within the queue. |
| 181 // Note: delayed tasks get their enqueue order set once their delay has |
| 182 // expired, and non-delayed tasks get their enqueue order set when posted. |
| 183 virtual void InsertFence(InsertFencePosition position) = 0; |
| 178 | 184 |
| 179 // Removes any previously added fence and unblocks execution of any tasks | 185 // Removes any previously added fence and unblocks execution of any tasks |
| 180 // blocked by it. | 186 // blocked by it. |
| 181 virtual void RemoveFence() = 0; | 187 virtual void RemoveFence() = 0; |
| 182 | 188 |
| 183 virtual bool BlockedByFence() const = 0; | 189 virtual bool BlockedByFence() const = 0; |
| 184 | 190 |
| 185 protected: | 191 protected: |
| 186 ~TaskQueue() override {} | 192 ~TaskQueue() override {} |
| 187 | 193 |
| 188 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 194 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 189 }; | 195 }; |
| 190 | 196 |
| 191 } // namespace scheduler | 197 } // namespace scheduler |
| 192 } // namespace blink | 198 } // namespace blink |
| 193 | 199 |
| 194 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 200 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |