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

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

Issue 2572893002: [Reland] Dont post delayed DoWork for disabled queues. (Closed)
Patch Set: Fix perftest Created 4 years 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_impl.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
index 2885ccdf52c2ec39fe0b6c21178b6b8002374722..79abf5825ec41f93c405525b4f4e9f457db508cb 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -276,11 +276,15 @@ void TaskQueueImpl::PushOntoDelayedIncomingQueueFromMainThread(
main_thread_only().delayed_incoming_queue.push(std::move(pending_task));
// If |pending_task| is at the head of the queue, then make sure a wakeup
- // is requested.
+ // is requested if the queue is enabled. Note we still want to schedule a
+ // wakeup even if blocked by a fence, because we'd break throttling logic
+ // otherwise.
if (main_thread_only().delayed_incoming_queue.top().delayed_run_time ==
- delayed_run_time) {
+ delayed_run_time &&
+ IsQueueEnabled()) {
+ LazyNow lazy_now(now);
main_thread_only().time_domain->ScheduleDelayedWork(
- this, pending_task.delayed_run_time, now);
+ this, pending_task.delayed_run_time, &lazy_now);
}
TraceQueueSize(false);
@@ -816,10 +820,19 @@ void TaskQueueImpl::EnableOrDisableWithSelector(bool enable) {
return;
if (enable) {
+ if (!main_thread_only().delayed_incoming_queue.empty()) {
+ LazyNow lazy_now = main_thread_only().time_domain->CreateLazyNow();
+ main_thread_only().time_domain->ScheduleDelayedWork(
+ this,
+ main_thread_only().delayed_incoming_queue.top().delayed_run_time,
+ &lazy_now);
+ }
// Note it's the job of the selector to tell the TaskQueueManager if
- // a DoWork needs posting.
+ // an immediate DoWork needs posting.
main_thread_only().task_queue_manager->selector_.EnableQueue(this);
} else {
+ if (!main_thread_only().delayed_incoming_queue.empty())
+ main_thread_only().time_domain->CancelDelayedWork(this);
main_thread_only().task_queue_manager->selector_.DisableQueue(this);
}
}

Powered by Google App Engine
This is Rietveld 408576698