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

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

Issue 2258713004: Make tasks cancellable inside the blink scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Various comment nits addressed Created 4 years, 4 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_sets.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h
index 1dd0fcfe4e49ea8eec487772b1c99a648aa490b2..0c56834462755e3b8014efd008635aaf5305baba 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h
@@ -21,6 +21,12 @@ namespace scheduler {
namespace internal {
class TaskQueueImpl;
+// There is a WorkQueueSet for each scheduler priority and each WorkQueueSet
+// uses a EnqueueOrderToWorkQueueMap to keep track of which queue in the set has
+// the oldest task (i.e. the one that should be run next if the
+// TaskQueueSelector chooses to run a task a given priority). The reason this
+// works is because std::map is a tree based associative container and all the
+// values are kept in sorted order.
class BLINK_PLATFORM_EXPORT WorkQueueSets {
public:
WorkQueueSets(size_t num_sets, const char* name);
@@ -39,8 +45,15 @@ class BLINK_PLATFORM_EXPORT WorkQueueSets {
void OnPushQueue(WorkQueue* work_queue);
// If empty it's O(1) amortized, otherwise it's O(log num queues)
+ // Assumes |work_queue| contains the lowest enqueue order in the set.
void OnPopQueue(WorkQueue* work_queue);
+ // Similar to OnPopQueue except it doesn't assume |work_queue| contains the
+ // lowest enqueue order in the set.
+ // O(log num queues)
+ void OnQueueHeadChanged(WorkQueue* work_queue,
+ EnqueueOrder erased_task_enqueue_order);
+
// O(1)
bool GetOldestQueueInSet(size_t set_index, WorkQueue** out_work_queue) const;

Powered by Google App Engine
This is Rietveld 408576698