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_; |