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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h

Issue 1989363005: Graceful idle callback cancellation with invalid IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/core/dom/ScriptedIdleTaskController.h
diff --git a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h
index 27d9878a90ed4678d58bcd82d16f478e1c85d0e1..f86a6db13afe79b1e39b211257432255f5796467 100644
--- a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h
+++ b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.h
@@ -43,6 +43,14 @@ public:
private:
explicit ScriptedIdleTaskController(ExecutionContext*);
+ int nextCallbackId();
+
+ bool isValidCallbackId(int id)
+ {
+ using Traits = HashTraits<CallbackId>;
+ return !Traits::isDeletedValue(id) && !WTF::isHashTraitsEmptyValue<Traits, CallbackId>(id);
+ }
+
void runCallback(CallbackId, double deadlineSeconds, IdleDeadline::CallbackType);
WebScheduler* m_scheduler; // Not owned.

Powered by Google App Engine
This is Rietveld 408576698