Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/work_queue.cc

Issue 2786083005: scheduler: Maintain a constant enqueue order for every task (Closed)
Patch Set: Update VirtualTimeTest Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
index f5b49d20381796bb1679ec5adf085c9a48de9460..80e1f7e65d884278a5dadb2d4a6cf4a1c86136d8 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
@@ -50,7 +50,8 @@ bool WorkQueue::BlockedByFence() const {
// If the queue is empty then any future tasks will have a higher enqueue
// order and will be blocked. The queue is also blocked if the head is past
// the fence.
- return work_queue_.empty() || work_queue_.front().enqueue_order() > fence_;
+ return work_queue_.empty() ||
+ work_queue_.front().enqueue_order().sequence_num > fence_;
}
bool WorkQueue::GetFrontTaskEnqueueOrder(EnqueueOrder* enqueue_order) const {
@@ -67,9 +68,6 @@ bool WorkQueue::GetFrontTaskEnqueueOrder(EnqueueOrder* enqueue_order) const {
void WorkQueue::Push(TaskQueueImpl::Task task) {
bool was_empty = work_queue_.empty();
-#ifndef NDEBUG
- DCHECK(task.enqueue_order_set());
-#endif
// Amoritized O(1).
work_queue_.push_back(std::move(task));
@@ -131,9 +129,11 @@ void WorkQueue::AssignSetIndex(size_t work_queue_set_index) {
work_queue_set_index_ = work_queue_set_index;
}
-bool WorkQueue::InsertFence(EnqueueOrder fence) {
+bool WorkQueue::InsertFence(uint64_t fence) {
DCHECK_NE(fence, 0u);
- DCHECK(fence >= fence_ || fence == 1u);
+ DCHECK(fence >= fence_ ||
+ fence == static_cast<uint64_t>(
+ EnqueueOrderSequenceNumberValues::BLOCKING_FENCE));
bool was_blocked_by_fence = BlockedByFence();
fence_ = fence;
// Moving the fence forward may unblock some tasks.
@@ -161,8 +161,8 @@ bool WorkQueue::RemoveFence() {
bool WorkQueue::ShouldRunBefore(const WorkQueue* other_queue) const {
DCHECK(!work_queue_.empty());
DCHECK(!other_queue->work_queue_.empty());
- EnqueueOrder enqueue_order = 0;
- EnqueueOrder other_enqueue_order = 0;
+ EnqueueOrder enqueue_order = {base::TimeTicks(), 0};
alex clarke (OOO till 29th) 2017/04/13 07:46:00 Can we have a default constructor?
Sami 2017/04/18 10:47:49 Done.
+ EnqueueOrder other_enqueue_order = {base::TimeTicks(), 0};
bool have_task = GetFrontTaskEnqueueOrder(&enqueue_order);
bool have_other_task =
other_queue->GetFrontTaskEnqueueOrder(&other_enqueue_order);

Powered by Google App Engine
This is Rietveld 408576698