Chromium Code Reviews| Index: base/debug/task_annotator.cc |
| diff --git a/base/debug/task_annotator.cc b/base/debug/task_annotator.cc |
| index 2747d63c2bf29aa3d356c8c750ff3784b943e66f..437d69a7f8be025b17dabe29adb12c7dedc63816 100644 |
| --- a/base/debug/task_annotator.cc |
| +++ b/base/debug/task_annotator.cc |
| @@ -28,34 +28,32 @@ void TaskAnnotator::DidQueueTask(const char* queue_function, |
| } |
| void TaskAnnotator::RunTask(const char* queue_function, |
| - const PendingTask& pending_task) { |
| - ScopedTaskRunActivity task_activity(pending_task); |
| + PendingTask* pending_task) { |
| + ScopedTaskRunActivity task_activity(*pending_task); |
| tracked_objects::TaskStopwatch stopwatch; |
| stopwatch.Start(); |
| tracked_objects::Duration queue_duration = |
| - stopwatch.StartTime() - pending_task.EffectiveTimePosted(); |
| + stopwatch.StartTime() - pending_task->EffectiveTimePosted(); |
| - TRACE_EVENT_WITH_FLOW1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), |
| - queue_function, |
| - TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
| - TRACE_EVENT_FLAG_FLOW_IN, |
| - "queue_duration", |
| - queue_duration.InMilliseconds()); |
| + TRACE_EVENT_WITH_FLOW1( |
| + TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), queue_function, |
| + TRACE_ID_MANGLE(GetTaskTraceID(*pending_task)), TRACE_EVENT_FLAG_FLOW_IN, |
| + "queue_duration", queue_duration.InMilliseconds()); |
| // Before running the task, store the program counter where it was posted |
| // and deliberately alias it to ensure it is on the stack if the task |
| // crashes. Be careful not to assume that the variable itself will have the |
| // expected value when displayed by the optimizer in an optimized build. |
| // Look at a memory dump of the stack. |
| - const void* program_counter = pending_task.posted_from.program_counter(); |
| + const void* program_counter = pending_task->posted_from.program_counter(); |
| debug::Alias(&program_counter); |
| - pending_task.task.Run(); |
| + std::move(pending_task->task).Run(); |
|
fdoray
2016/10/06 17:37:22
It's annoying that Run() can only be called on an
tzik
2016/10/13 05:58:04
Per discussion on the mail thread:
In the new sema
|
| stopwatch.Stop(); |
| - tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking( |
| - pending_task, stopwatch); |
| + tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(*pending_task, |
| + stopwatch); |
| } |
| uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const { |