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 a9659b3aec17d700fa7f99b6e27272f221aabfe0..360ec49950021659203e9d00fb4db875281d92d4 100644 |
--- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h |
+++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h |
@@ -24,13 +24,17 @@ 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 TimeDomain's job is to wake task queues up when their next delayed tasks |
+// are due to fire. TaskQueues request a wake up via ScheduleDelayedWork, when |
+// the WakeUp is due the TimeDomain calls TaskQueue::WakeUpForDelayedWork which |
+// schedules the next non-canceled wakeup. |
// |
-// 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. |
+// To prevent spurious wake-ups for canceled tasks the TaskQueue should only |
+// have a single wake up registered with its TimeDomain. If should call |
+// CancelDelayedWork as needed to ensure this. The TimeDomain communicates with |
+// the TaskQueueManager to actually schedule the wake-ups on the underlying |
+// base::MessageLoop. Various levels of de-duping are employed to prevent |
+// unnecessary posting of TaskQueueManager::DoWork. |
// |
// The clock itself is provided by subclasses of the TimeDomain and it may be |
// the real wall clock or a synthetic (virtual) time base. |
@@ -89,13 +93,13 @@ class BLINK_PLATFORM_EXPORT TimeDomain { |
// UpdateWorkQueue on. |
void RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue); |
- // Schedules a call to TaskQueueImpl::MoveReadyDelayedTasksToDelayedWorkQueue |
+ // Schedules a call to TaskQueueImpl::WakeUpForDelayedWork |
// when this TimeDomain reaches |delayed_run_time|. |
void ScheduleDelayedWork(internal::TaskQueueImpl* queue, |
base::TimeTicks delayed_run_time, |
base::TimeTicks now); |
- // Cancels a call to TaskQueueImpl::MoveReadyDelayedTasksToDelayedWorkQueue |
+ // Cancels a call to TaskQueueImpl::WakeUpForDelayedWork |
// previously requested with ScheduleDelayedWork. Note this only works if |
// delayed_run_time is _not_ the next scheduled run time. |
void CancelDelayedWork(internal::TaskQueueImpl* queue, |