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

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

Issue 2653643002: Move has_incoming_immediate_work to the TaskQueueManager (Closed)
Patch Set: Don't try to be quite so clever in TaskQueueManager::ComputeDelayTillNextTask 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 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 0ead39ea836ca05bd5cc6686569fd6336ac270eb..e99519df8fc4b9ad0fe2fae6b6832ee5c6230c7c 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
@@ -327,19 +327,17 @@ void TaskQueueImpl::PushOntoImmediateIncomingQueueLocked(
base::TimeTicks desired_run_time,
EnqueueOrder sequence_number,
bool nestable) {
- if (any_thread().immediate_incoming_queue.empty())
- any_thread().time_domain->OnQueueHasIncomingImmediateWork(this);
// If the |immediate_incoming_queue| is empty we need a DoWork posted to make
// it run.
if (any_thread().immediate_incoming_queue.empty()) {
- // There's no point posting a DoWork for a disabled queue, however we can
+ // However there's no point posting a DoWork for a blocked queue. NB we can
// only tell if it's disabled from the main thread.
- if (base::PlatformThread::CurrentId() == thread_id_) {
- if (IsQueueEnabled() && !BlockedByFenceLocked())
- any_thread().task_queue_manager->MaybeScheduleImmediateWork(FROM_HERE);
- } else {
- any_thread().task_queue_manager->MaybeScheduleImmediateWork(FROM_HERE);
- }
+ bool queue_is_blocked =
+ RunsTasksOnCurrentThread() &&
+ (!IsQueueEnabled() || main_thread_only().current_fence);
+ any_thread().task_queue_manager->OnQueueHasIncomingImmediateWork(
+ this, queue_is_blocked);
+ any_thread().time_domain->OnQueueHasImmediateWork(this);
}
any_thread().immediate_incoming_queue.emplace_back(
posted_from, task, desired_run_time, sequence_number, nestable,
@@ -674,22 +672,6 @@ bool TaskQueueImpl::BlockedByFence() const {
main_thread_only().current_fence;
}
-bool TaskQueueImpl::BlockedByFenceLocked() const {
- if (!main_thread_only().current_fence)
- return false;
-
- if (!main_thread_only().immediate_work_queue->BlockedByFence() ||
- !main_thread_only().delayed_work_queue->BlockedByFence()) {
- return false;
- }
-
- if (any_thread().immediate_incoming_queue.empty())
- return true;
-
- return any_thread().immediate_incoming_queue.front().enqueue_order() >
- main_thread_only().current_fence;
-}
-
EnqueueOrder TaskQueueImpl::GetFenceForTest() const {
return main_thread_only().current_fence;
}

Powered by Google App Engine
This is Rietveld 408576698