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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h

Issue 2718293003: scheduler: Ensure consistent delayed task ordering between task queues (Closed)
Patch Set: Review comments Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
index 8381157e847d6e1ff1add54fc5fd4e34ebde8da5..79503356b851cf354ffc12f40d93ef4b862e6fac 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
@@ -111,6 +111,21 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
EnqueueOrder enqueue_order_;
};
+ // Represents a time at which a task wants to run. Tasks scheduled for the
+ // same point in time will be ordered by their sequence numbers.
+ struct DelayedWakeUp {
+ base::TimeTicks time;
+ int sequence_num;
+
+ bool operator<=(const DelayedWakeUp& other) const {
+ if (time == other.time) {
+ DCHECK_NE(sequence_num, other.sequence_num);
+ return (sequence_num - other.sequence_num) < 0;
+ }
+ return time < other.time;
+ }
+ };
+
// TaskQueue implementation.
void UnregisterTaskQueue() override;
bool RunsTasksOnCurrentThread() const override;
@@ -177,9 +192,9 @@ class BLINK_PLATFORM_EXPORT TaskQueueImpl final : public TaskQueue {
}
// Enqueues any delayed tasks which should be run now on the
- // |delayed_work_queue|. Returns the deadline if a subsequent wakeup is
- // required. Must be called from the main thread.
- base::Optional<base::TimeTicks> WakeUpForDelayedWork(LazyNow* lazy_now);
+ // |delayed_work_queue|. Returns the subsequent wakeup that is required, if
+ // any. Must be called from the main thread.
+ base::Optional<DelayedWakeUp> WakeUpForDelayedWork(LazyNow* lazy_now);
base::TimeTicks scheduled_time_domain_wakeup() const {
return main_thread_only().scheduled_time_domain_wakeup;
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698