Chromium Code Reviews| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 virtual void SetBlameContext( | 165 virtual void SetBlameContext( |
| 166 base::trace_event::BlameContext* blame_context) = 0; | 166 base::trace_event::BlameContext* blame_context) = 0; |
| 167 | 167 |
| 168 // Removes the task queue from the previous TimeDomain and adds it to | 168 // Removes the task queue from the previous TimeDomain and adds it to |
| 169 // |domain|. This is a moderately expensive operation. | 169 // |domain|. This is a moderately expensive operation. |
| 170 virtual void SetTimeDomain(TimeDomain* domain) = 0; | 170 virtual void SetTimeDomain(TimeDomain* domain) = 0; |
| 171 | 171 |
| 172 // Returns the queue's current TimeDomain. Can be called from any thread. | 172 // Returns the queue's current TimeDomain. Can be called from any thread. |
| 173 virtual TimeDomain* GetTimeDomain() const = 0; | 173 virtual TimeDomain* GetTimeDomain() const = 0; |
| 174 | 174 |
| 175 enum class InsertFencePosition { | |
| 176 NOW, | |
|
alex clarke (OOO till 29th)
2016/11/25 16:20:49
I'm thinking ahead in case we ever add a third val
altimin
2016/11/25 16:59:26
Done.
| |
| 177 BEGINNING_OF_TIME, | |
| 178 }; | |
| 179 | |
| 175 // Inserts a barrier into the task queue which inhibits non-delayed tasks | 180 // Inserts a barrier into the task queue which inhibits non-delayed tasks |
| 176 // posted after this point, or delayed tasks which are not yet ready to run, | 181 // posted after given point, or delayed tasks which are not yet ready to run, |
| 177 // from being executed until the fence is cleared. If a fence already existed | 182 // from being executed until the fence is cleared. If the fence is installed |
| 178 // the one supersedes it and previously blocked tasks will now run up until | 183 // at the beginning of time, it will block all tasks in this queue, |
| 179 // the new fence is hit. | 184 // effectively disabling it. |
| 180 virtual void InsertFence() = 0; | 185 // |
| 186 // If a fence already existed the one supersedes it and previously blocked | |
| 187 // tasks will now run up until the new fence is hit. | |
| 188 virtual void InsertFence(InsertFencePosition position) = 0; | |
| 181 | 189 |
| 182 // Removes any previously added fence and unblocks execution of any tasks | 190 // Removes any previously added fence and unblocks execution of any tasks |
| 183 // blocked by it. | 191 // blocked by it. |
| 184 virtual void RemoveFence() = 0; | 192 virtual void RemoveFence() = 0; |
| 185 | 193 |
| 186 virtual bool BlockedByFence() const = 0; | 194 virtual bool BlockedByFence() const = 0; |
| 187 | 195 |
| 188 protected: | 196 protected: |
| 189 ~TaskQueue() override {} | 197 ~TaskQueue() override {} |
| 190 | 198 |
| 191 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 199 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 192 }; | 200 }; |
| 193 | 201 |
| 194 } // namespace scheduler | 202 } // namespace scheduler |
| 195 } // namespace blink | 203 } // namespace blink |
| 196 | 204 |
| 197 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ | 205 #endif // THIRD_PARTY_WEBKIT_PUBLIC_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_H_ |
| OLD | NEW |