Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/enqueue_order.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.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/enqueue_order.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/enqueue_order.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h b/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h
index 6318555718ac07995c56513f46a3c797a4adf019..6b0e76bbdd83929adc6ced93e4ea6afa8eaea9ac 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h
@@ -15,13 +15,21 @@ namespace internal {
using EnqueueOrder = uint64_t;
+// A 64bit integer used to provide ordering of tasks. NOTE The scheduler assumes
+// these values will not overflow.
class EnqueueOrderGenerator {
public:
EnqueueOrderGenerator();
~EnqueueOrderGenerator();
+ // Returns a monotonically increasing integer, starting from one. Can be
+ // called from any thread.
EnqueueOrder GenerateNext();
+ static bool IsValidEnqueueOrder(EnqueueOrder enqueue_order) {
+ return enqueue_order != 0ull;
+ }
+
private:
base::Lock lock_;
EnqueueOrder enqueue_order_;
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/enqueue_order.cc » ('j') | no next file with comments »

Powered by Google App Engine