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

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

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Added the MoveableAutoLock per Sami's suggestion 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/work_queue.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
index fe168586f28104b75b14dee6a1869efce6bb80a2..ac312f939947f6a1c54a0c27d8002be53a757412 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
@@ -10,12 +10,15 @@ namespace blink {
namespace scheduler {
namespace internal {
-WorkQueue::WorkQueue(TaskQueueImpl* task_queue, const char* name)
+WorkQueue::WorkQueue(TaskQueueImpl* task_queue,
+ const char* name,
+ QueueType queue_type)
: work_queue_sets_(nullptr),
task_queue_(task_queue),
work_queue_set_index_(0),
name_(name),
- fence_(0) {}
+ fence_(0),
+ queue_type_(queue_type) {}
void WorkQueue::AsValueInto(base::trace_event::TracedValue* state) const {
// Remove const to search |work_queue_| in the destructive manner. Restore the
@@ -116,6 +119,10 @@ TaskQueueImpl::Task WorkQueue::TakeTaskFromWorkQueue() {
TaskQueueImpl::Task pending_task =
std::move(const_cast<TaskQueueImpl::Task&>(work_queue_.front()));
work_queue_.pop();
+ // NB immediate tasks have a different pipeline to delayed ones.
+ if (queue_type_ == QueueType::IMMEDIATE && work_queue_.empty())
+ task_queue_->OnImmediateWorkQueueHasBecomeEmpty(&work_queue_);
+ // OnPopQueue checks BlockedByFence() so we don't need to here.
work_queue_sets_->OnPopQueue(this);
task_queue_->TraceQueueSize(false);
return pending_task;

Powered by Google App Engine
This is Rietveld 408576698