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

Unified Diff: base/debug/task_annotator.cc

Issue 2386653002: Replace base::Callback with base::OnceCallback in base::PendingTask (Closed)
Patch Set: move UnsafeConvertOnceClosureToRepeating 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/debug/task_annotator.h ('k') | base/debug/task_annotator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
stopwatch.Stop();
- tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(
- pending_task, stopwatch);
+ tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(*pending_task,
+ stopwatch);
}
uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const {
« no previous file with comments | « base/debug/task_annotator.h ('k') | base/debug/task_annotator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698