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

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

Issue 2319053004: [Reland] Make canceling Timers fast. (Closed)
Patch Set: Add missing file 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/task_queue_manager.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
index f44ee457a87e5189ddb438b495d6db1920f95be9..9d1b182dba0decec44806a75e22ec354ea243e6c 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
@@ -282,12 +282,18 @@ TaskQueueManager::ProcessTaskResult TaskQueueManager::ProcessTaskFromWorkQueue(
internal::TaskQueueImpl::Task pending_task =
work_queue->TakeTaskFromWorkQueue();
+
+ // It's possible the task was canceled, if so bail out.
+ if (pending_task.task.IsCancelled())
+ return ProcessTaskResult::EXECUTED;
+
if (!pending_task.nestable && delegate_->IsNested()) {
// Defer non-nestable work to the main task runner. NOTE these tasks can be
// arbitrarily delayed so the additional delay should not be a problem.
// TODO(skyostil): Figure out a way to not forget which task queue the
// task is associated with. See http://crbug.com/522843.
- delegate_->PostNonNestableTask(pending_task.posted_from, pending_task.task);
+ delegate_->PostNonNestableTask(pending_task.posted_from,
+ std::move(pending_task.task));
return ProcessTaskResult::DEFERRED;
}

Powered by Google App Engine
This is Rietveld 408576698