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

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

Issue 2359493002: Prevent redundant DoWorks due to canceled delayed tasks (v2) (Closed)
Patch Set: Changes for Alexander 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 db351c79c3fe52a81049d8c2679f2e014581a695..1c6836e0f515a7c9468c01749b35663884b8aa3d 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
@@ -189,11 +189,13 @@ void TaskQueueManager::MaybeScheduleDelayedWork(
main_thread_pending_wakeups_.end()) {
return;
}
-
// De-duplicate DoWork posts.
base::TimeTicks run_time = now + delay;
- if (!main_thread_pending_wakeups_.insert(run_time).second)
+ if (!main_thread_pending_wakeups_.empty() &&
+ *main_thread_pending_wakeups_.begin() <= run_time) {
return;
+ }
+ main_thread_pending_wakeups_.insert(run_time);
delegate_->PostDelayedTask(
from_here, base::Bind(&TaskQueueManager::DoWork,
weak_factory_.GetWeakPtr(), run_time, true),

Powered by Google App Engine
This is Rietveld 408576698