| Index: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
|
| diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
|
| index 2ead6857ad27f2719dfad5844021be6b397c79fb..5e5d7b7444be62146d1158e0bfb2fc3b3ae05459 100644
|
| --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
|
| +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
|
| @@ -402,7 +402,7 @@
|
| return task_count;
|
| }
|
|
|
| -bool TaskQueueImpl::HasTaskToRunImmediately() const {
|
| +bool TaskQueueImpl::HasPendingImmediateWork() const {
|
| // Any work queue tasks count as immediate work.
|
| if (!main_thread_only().delayed_work_queue->Empty() ||
|
| !main_thread_only().immediate_work_queue->Empty()) {
|
| @@ -821,11 +821,8 @@
|
| return;
|
|
|
| if (enable) {
|
| - if (HasPendingImmediateWork() && main_thread_only().observer) {
|
| - // Delayed work notification will be issued via time domain.
|
| - main_thread_only().observer->OnQueueNextWakeUpChanged(this,
|
| - base::TimeTicks());
|
| - }
|
| + if (HasPendingImmediateWork())
|
| + NotifyWakeUpChangedOnMainThread(base::TimeTicks());
|
|
|
| ScheduleDelayedWorkInTimeDomain(main_thread_only().time_domain->Now());
|
|
|
| @@ -902,33 +899,14 @@
|
| main_thread_only().time_domain->ScheduleDelayedWork(
|
| this, main_thread_only().delayed_incoming_queue.top().delayed_wake_up(),
|
| now);
|
| -}
|
| -
|
| -void TaskQueueImpl::SetScheduledTimeDomainWakeUp(
|
| - base::Optional<base::TimeTicks> scheduled_time_domain_wake_up) {
|
| - main_thread_only().scheduled_time_domain_wake_up =
|
| - scheduled_time_domain_wake_up;
|
| -
|
| - // If queue has immediate work an appropriate notification has already
|
| - // been issued.
|
| - if (!scheduled_time_domain_wake_up || !main_thread_only().observer ||
|
| - HasPendingImmediateWork())
|
| - return;
|
| -
|
| - main_thread_only().observer->OnQueueNextWakeUpChanged(
|
| - this, scheduled_time_domain_wake_up.value());
|
| -}
|
| -
|
| -bool TaskQueueImpl::HasPendingImmediateWork() {
|
| - // Any work queue tasks count as immediate work.
|
| - if (!main_thread_only().delayed_work_queue->Empty() ||
|
| - !main_thread_only().immediate_work_queue->Empty()) {
|
| - return true;
|
| - }
|
| -
|
| - // Finally tasks on |immediate_incoming_queue| count as immediate work.
|
| - base::AutoLock lock(immediate_incoming_queue_lock_);
|
| - return !immediate_incoming_queue().empty();
|
| +
|
| + NotifyWakeUpChangedOnMainThread(
|
| + main_thread_only().delayed_incoming_queue.top().delayed_run_time);
|
| +}
|
| +
|
| +void TaskQueueImpl::NotifyWakeUpChangedOnMainThread(base::TimeTicks wake_up) {
|
| + if (main_thread_only().observer)
|
| + main_thread_only().observer->OnQueueNextWakeUpChanged(this, wake_up);
|
| }
|
|
|
| } // namespace internal
|
|
|