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

Unified Diff: base/task_scheduler/scheduler_worker.cc

Issue 2399213005: TaskScheduler: Change Sequence::PeekTask to Sequence::TakeTask. (Closed)
Patch Set: CR robliao #5 Created 4 years, 2 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
« no previous file with comments | « base/task_scheduler/scheduler_worker.h ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/scheduler_worker.cc
diff --git a/base/task_scheduler/scheduler_worker.cc b/base/task_scheduler/scheduler_worker.cc
index 2bed780826e1e3b09a3bf2622455da4e54db0593..1f5625c7a35f0d935bdc9d583d478aa2bdc22e9d 100644
--- a/base/task_scheduler/scheduler_worker.cc
+++ b/base/task_scheduler/scheduler_worker.cc
@@ -70,12 +70,13 @@ class SchedulerWorker::Thread : public PlatformThread::Delegate {
continue;
}
- const Task* task = sequence->PeekTask();
- const TimeTicks start_time = TimeTicks::Now();
- if (outer_->task_tracker_->RunTask(task, sequence->token()))
- outer_->delegate_->DidRunTask(task, start_time - task->sequenced_time);
+ std::unique_ptr<Task> task = sequence->TakeTask();
+ const TaskPriority task_priority = task->traits.priority();
+ const TimeDelta task_latency = TimeTicks::Now() - task->sequenced_time;
+ if (outer_->task_tracker_->RunTask(std::move(task), sequence->token()))
+ outer_->delegate_->DidRunTaskWithPriority(task_priority, task_latency);
- const bool sequence_became_empty = sequence->PopTask();
+ const bool sequence_became_empty = sequence->Pop();
// If |sequence| isn't empty immediately after the pop, re-enqueue it to
// maintain the invariant that a non-empty Sequence is always referenced
« no previous file with comments | « base/task_scheduler/scheduler_worker.h ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698