| 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 639d1742a35feec99c4355430a72a7ab048b076a..3d454077fa359aa9a6d0b815ec8c176c08c155f4 100644
|
| --- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
|
| +++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
|
| @@ -62,9 +62,11 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
|
| // Evaluate this TimeDomain's Now. Can be called from any thread.
|
| virtual base::TimeTicks Now() const = 0;
|
|
|
| - // Some TimeDomains support virtual time, this method tells us to advance time
|
| - // if possible and return true if time was advanced.
|
| - virtual bool MaybeAdvanceTime() = 0;
|
| + // Computes the delay until the next task the TimeDomain is aware of, if any.
|
| + // Note virtual time domains may return base::TimeDelta() if they have any
|
| + // tasks that are eligible to run.
|
| + virtual base::Optional<base::TimeDelta> DelayTillNextTask(
|
| + LazyNow* lazy_now) = 0;
|
|
|
| // Returns the name of this time domain for tracing.
|
| virtual const char* GetName() const = 0;
|
| @@ -80,18 +82,14 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
|
| void AsValueInto(base::trace_event::TracedValue* state) const;
|
|
|
| // Migrates |queue| from this time domain to |destination_time_domain|.
|
| - // Main-thread only.
|
| - void MigrateQueue(internal::TaskQueueImpl* queue,
|
| - TimeDomain* destination_time_domain);
|
| + // Main-thread only. Returns the time of the scheduled wakeup if any,
|
| + base::TimeTicks MigrateQueue(internal::TaskQueueImpl* queue,
|
| + TimeDomain* destination_time_domain);
|
|
|
| // If there is a scheduled delayed task, |out_task_queue| is set to the queue
|
| // the next task was posted to and it returns true. Returns false otherwise.
|
| bool NextScheduledTaskQueue(TaskQueue** out_task_queue) const;
|
|
|
| - // Adds |queue| to the set of task queues that UpdateWorkQueues calls
|
| - // UpdateWorkQueue on.
|
| - void RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
|
| -
|
| // Schedules a call to TaskQueueImpl::WakeUpForDelayedWork when this
|
| // TimeDomain reaches |delayed_run_time|. This supersedes any previously
|
| // registered wakeup for |queue|.
|
| @@ -99,18 +97,19 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
|
| base::TimeTicks delayed_run_time,
|
| base::TimeTicks now);
|
|
|
| + // Cancels any scheduled calls to TaskQueueImpl::WakeUpForDelayedWork for
|
| + // |queue|.
|
| + void CancelDelayedWork(internal::TaskQueueImpl* queue);
|
| +
|
| // Registers the |queue|.
|
| void RegisterQueue(internal::TaskQueueImpl* queue);
|
|
|
| - // Removes |queue| from the set of task queues that UpdateWorkQueues calls
|
| - // UpdateWorkQueue on. Returns true if |queue| was updatable.
|
| - bool UnregisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
|
| -
|
| // Removes |queue| from all internal data structures.
|
| void UnregisterQueue(internal::TaskQueueImpl* queue);
|
|
|
| - // Updates active queues associated with this TimeDomain.
|
| - void UpdateWorkQueues(LazyNow lazy_now);
|
| + // Tells the time domain that |queue| went from having no immediate work to
|
| + // having some.
|
| + void OnQueueHasImmediateWork(internal::TaskQueueImpl* queue);
|
|
|
| // Called by the TaskQueueManager when the TimeDomain is registered.
|
| virtual void OnRegisterWithTaskQueueManager(
|
| @@ -136,8 +135,6 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
|
| }
|
|
|
| private:
|
| - void MoveNewlyUpdatableQueuesIntoUpdatableQueueSet();
|
| -
|
| struct DelayedWakeup {
|
| base::TimeTicks time;
|
| internal::TaskQueueImpl* queue;
|
| @@ -164,16 +161,7 @@ class BLINK_PLATFORM_EXPORT TimeDomain {
|
|
|
| IntrusiveHeap<DelayedWakeup> delayed_wakeup_queue_;
|
|
|
| - // This lock guards only |newly_updatable_|. It's not expected to be heavily
|
| - // contended.
|
| - base::Lock newly_updatable_lock_;
|
| - std::vector<internal::TaskQueueImpl*> newly_updatable_;
|
| -
|
| - // Set of task queues with avaliable work on the incoming queue. This should
|
| - // only be accessed from the main thread.
|
| - std::set<internal::TaskQueueImpl*> updatable_queue_set_;
|
| -
|
| - Observer* observer_; // NOT OWNED.
|
| + Observer* const observer_; // NOT OWNED.
|
|
|
| base::ThreadChecker main_thread_checker_;
|
|
|
|
|