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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/time_domain.cc

Issue 2326313003: Revert of Make canceling Timers fast. (Closed)
Patch Set: Created 4 years, 3 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.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc b/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc
index 3093132d23a9c932bd99b8be8d4787800dfeca79..5837384e776dbb4f8e12d192a063927f9f2c2550 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc
@@ -159,16 +159,14 @@
MoveNewlyUpdatableQueuesIntoUpdatableQueueSet();
- std::set<internal::TaskQueueImpl*>::iterator iter =
- updatable_queue_set_.begin();
+ auto iter = updatable_queue_set_.begin();
while (iter != updatable_queue_set_.end()) {
- std::set<internal::TaskQueueImpl*>::iterator queue_it = iter++;
- internal::TaskQueueImpl* queue = *queue_it;
-
- // Update the queue and remove from the set if subsequent updates are not
- // required.
- if (!queue->MaybeUpdateImmediateWorkQueues())
- updatable_queue_set_.erase(queue_it);
+ internal::TaskQueueImpl* queue = *iter++;
+ // NOTE Update work queue may erase itself from |updatable_queue_set_|.
+ // This is fine, erasing an element won't invalidate any interator, as long
+ // as the iterator isn't the element being delated.
+ if (queue->immediate_work_queue()->Empty())
+ queue->UpdateImmediateWorkQueue();
}
}
@@ -198,7 +196,7 @@
// in which EnqueueTaskLocks is called is respected when choosing which
// queue to execute a task from.
if (dedup_set.insert(next_wakeup->second).second) {
- next_wakeup->second->MoveReadyDelayedTasksToDelayedWorkQueue(lazy_now);
+ next_wakeup->second->UpdateDelayedWorkQueue(lazy_now);
}
delayed_wakeup_multimap_.erase(next_wakeup);
}

Powered by Google App Engine
This is Rietveld 408576698