Index: base/message_loop/message_loop.cc |
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc |
index 92039e237b885fbdadde39d3269554127a73df9d..e1f0258a9c757a112e2c0818aaf2a33dea2adf3d 100644 |
--- a/base/message_loop/message_loop.cc |
+++ b/base/message_loop/message_loop.cc |
@@ -458,9 +458,14 @@ void MessageLoop::RunTask(const PendingTask& pending_task) { |
TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
"queue_duration", |
(start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); |
- TRACE_EVENT2("task", "MessageLoop::RunTask", |
- "src_file", pending_task.posted_from.file_name(), |
- "src_func", pending_task.posted_from.function_name()); |
+ // When tracing memory for posted tasks it's more valuable to attribute the |
+ // memory allocations to the source function than generically to "RunTask". |
+ // Use a TRACE_EVENT2 variation to record a normal trace event but attribute |
+ // the memory to the pending task's source function name. |
+ TRACE_EVENT2_MEMORY_ARG2( |
+ "task", "MessageLoop::RunTask", |
+ "src_file", pending_task.posted_from.file_name(), |
+ "src_func", pending_task.posted_from.function_name()); |
DCHECK(nestable_tasks_allowed_); |
// Execute the task and assume the worst: It is probably not reentrant. |