Chromium Code Reviews| Index: base/task_scheduler/task_tracker.cc |
| diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc |
| index be54614bec03fc63c555e8435cf62c529f642904..90c52937747ea459761ad8b972b6f4b2c6e2b8a7 100644 |
| --- a/base/task_scheduler/task_tracker.cc |
| +++ b/base/task_scheduler/task_tracker.cc |
| @@ -213,6 +213,7 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task, |
| const TaskShutdownBehavior shutdown_behavior = |
| task->traits.shutdown_behavior(); |
| const bool can_run_task = BeforeRunTask(shutdown_behavior); |
| + const bool is_delayed = !task->delayed_run_time.is_null(); |
| if (can_run_task) { |
| // All tasks run through here and the scheduler itself doesn't use |
| @@ -254,14 +255,13 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task, |
| MakeUnique<TaskTracingInfo>(task->traits, execution_mode, |
| sequence_token)); |
| - debug::TaskAnnotator task_annotator; |
| - task_annotator.RunTask(kQueueFunctionName, task.get()); |
| + PerformRunTask(std::move(task)); |
| } |
| AfterRunTask(shutdown_behavior); |
| } |
| - if (task->delayed_run_time.is_null()) |
| + if (!is_delayed) |
| DecrementNumPendingUndelayedTasks(); |
| return can_run_task; |
| @@ -280,6 +280,10 @@ void TaskTracker::SetHasShutdownStartedForTesting() { |
| state_->StartShutdown(); |
| } |
| +void TaskTracker::PerformRunTask(std::unique_ptr<Task> task) { |
| + debug::TaskAnnotator().RunTask(kQueueFunctionName, task.get()); |
|
gab
2016/10/21 16:10:48
Actually this makes me realize that I'm not sure i
fdoray
2016/10/27 13:06:50
Yes, it's wrong to initialize a TaskAnnotator ever
|
| +} |
| + |
| void TaskTracker::PerformShutdown() { |
| { |
| AutoSchedulerLock auto_lock(shutdown_lock_); |