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

Unified Diff: components/scheduler/base/time_domain.cc

Issue 2189573002: Fix TimeDomain::MigrateQueue with incoming immediate tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: components/scheduler/base/time_domain.cc
diff --git a/components/scheduler/base/time_domain.cc b/components/scheduler/base/time_domain.cc
index 0e3144cdc750c716dbb8ec26ed2e012fa7663b18..d39e3cb71ca583027044dc5f68b7c1842461af2a 100644
--- a/components/scheduler/base/time_domain.cc
+++ b/components/scheduler/base/time_domain.cc
@@ -47,7 +47,11 @@ void TimeDomain::MigrateQueue(internal::TaskQueueImpl* queue,
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK_EQ(queue->GetTimeDomain(), this);
DCHECK(destination_time_domain);
- UnregisterAsUpdatableTaskQueue(queue);
+
+ // Make sure we remember to update |queue| if it's got incomming immediate
Sami 2016/07/27 09:57:56 s/incomming/incoming/
alex clarke (OOO till 29th) 2016/07/27 10:14:56 Done.
+ // work.
+ if (UnregisterAsUpdatableTaskQueue(queue))
+ destination_time_domain->updatable_queue_set_.insert(queue);
base::TimeTicks destination_now = destination_time_domain->Now();
// We need to remove |task_queue| from delayed_wakeup_multimap_ which is a
@@ -89,11 +93,11 @@ void TimeDomain::RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue) {
observer_->OnTimeDomainHasImmediateWork();
}
-void TimeDomain::UnregisterAsUpdatableTaskQueue(
+bool TimeDomain::UnregisterAsUpdatableTaskQueue(
internal::TaskQueueImpl* queue) {
DCHECK(main_thread_checker_.CalledOnValidThread());
- updatable_queue_set_.erase(queue);
+ bool was_updatable = updatable_queue_set_.erase(queue) != 0;
base::AutoLock lock(newly_updatable_lock_);
// Remove all copies of |queue| from |newly_updatable_|.
@@ -102,10 +106,12 @@ void TimeDomain::UnregisterAsUpdatableTaskQueue(
// Move last element into slot #i and then compact.
newly_updatable_[i] = newly_updatable_.back();
newly_updatable_.pop_back();
+ was_updatable = true;
} else {
i++;
}
}
+ return was_updatable;
}
void TimeDomain::UpdateWorkQueues(

Powered by Google App Engine
This is Rietveld 408576698