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

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

Issue 2637463002: Add an idle task to periodically sweep canceled delayed tasks (Closed)
Patch Set: Fix issue with tracked_objects::Location spotted by asan Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/scheduler/base/task_queue_manager.h" 5 #include "platform/scheduler/base/task_queue_manager.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 if (observer_) { 487 if (observer_) {
488 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), 488 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(),
489 *work_queue->GetFrontTask()); 489 *work_queue->GetFrontTask());
490 } 490 }
491 } 491 }
492 492
493 bool TaskQueueManager::HasImmediateWorkForTesting() const { 493 bool TaskQueueManager::HasImmediateWorkForTesting() const {
494 return !selector_.EnabledWorkQueuesEmpty(); 494 return !selector_.EnabledWorkQueuesEmpty();
495 } 495 }
496 496
497 void TaskQueueManager::SweepCanceledDelayedTasks() {
498 std::map<TimeDomain*, base::TimeTicks> time_domain_now;
499 for (const scoped_refptr<internal::TaskQueueImpl>& queue : queues_) {
500 TimeDomain* time_domain = queue->GetTimeDomain();
501 if (time_domain_now.find(time_domain) == time_domain_now.end())
502 time_domain_now.insert(std::make_pair(time_domain, time_domain->Now()));
503 queue->SweepCanceledDelayedTasks(time_domain_now[time_domain]);
504 }
505 }
506
497 } // namespace scheduler 507 } // namespace scheduler
498 } // namespace blink 508 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698