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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/time_domain.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/time_domain.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
index 12ba4c96d1255ec5ec4bb26791afa2c5b50c83e0..5c4379ee3de28bfcb8f1d420aca36d2c473ade92 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
@@ -24,6 +24,16 @@ class TaskQueueImpl;
class TaskQueueManager;
class TaskQueueManagerDelegate;
+// The TimeDomain's job is to keep track of moments when delayed tasks have been
+// scheduled to fire and to notify their TaskQueues via UpdateDelayedWorkQueue.
+//
+// The time domain keeps track of the next wakeup required to pump delayed tasks
+// and issues |RequestWakeup| calls to the subclass as needed. Where possible
+// it tried to de-dupe these wakeups. Ideally it would be possible to cancel
+// them, but that's not currently supported by the base message loop.
+//
+// The clock itself is provided by subclasses of the TimeDomain and it may be
+// the real wall clock or a synthetic (virtual) time base.
class BLINK_PLATFORM_EXPORT TimeDomain {
public:
class BLINK_PLATFORM_EXPORT Observer {
@@ -85,6 +95,12 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
base::TimeTicks delayed_run_time,
base::TimeTicks now);
+ // Cancels a call to TaskQueueImpl::MoveReadyDelayedTasksToDelayedWorkQueue
+ // previously requested with ScheduleDelayedWork. Note this only works if
+ // delayed_run_time is _not_ the next scheduled run time.
+ void CancelDelayedWork(internal::TaskQueueImpl* queue,
+ base::TimeTicks delayed_run_time);
+
// Registers the |queue|.
void RegisterQueue(internal::TaskQueueImpl* queue);

Powered by Google App Engine
This is Rietveld 408576698