Index: base/message_loop/message_loop.cc |
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc |
index c0d9b0e50ed5ab3be12355994246dd943ec2929a..69a02a30bca58dc92d5b54e61890ae4cb2205489 100644 |
--- a/base/message_loop/message_loop.cc |
+++ b/base/message_loop/message_loop.cc |
@@ -8,8 +8,6 @@ |
#include "base/bind.h" |
#include "base/compiler_specific.h" |
-#include "base/debug/alias.h" |
-#include "base/debug/trace_event.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
@@ -423,45 +421,20 @@ bool MessageLoop::ProcessNextDelayedNonNestableTask() { |
} |
void MessageLoop::RunTask(const PendingTask& pending_task) { |
- tracked_objects::TrackedTime start_time = |
- tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); |
- |
- TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), |
- "MessageLoop::PostTask", TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), |
- "queue_duration", |
- (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); |
- // When tracing memory for posted tasks it's more valuable to attribute the |
- // memory allocations to the source function than generically to "RunTask". |
- TRACE_EVENT_WITH_MEMORY_TAG2( |
- "toplevel", "MessageLoop::RunTask", |
- pending_task.posted_from.function_name(), // Name for memory tracking. |
- "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. |
nestable_tasks_allowed_ = false; |
- // 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(); |
- debug::Alias(&program_counter); |
- |
HistogramEvent(kTaskRunEvent); |
FOR_EACH_OBSERVER(TaskObserver, task_observers_, |
WillProcessTask(pending_task)); |
- pending_task.task.Run(); |
+ task_annotator_.RunTask( |
+ "MessageLoop::PostTask", "MessageLoop::RunTask", pending_task); |
FOR_EACH_OBSERVER(TaskObserver, task_observers_, |
DidProcessTask(pending_task)); |
- tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, |
- start_time, tracked_objects::ThreadData::NowForEndOfRun()); |
- |
nestable_tasks_allowed_ = true; |
} |
@@ -513,11 +486,6 @@ bool MessageLoop::DeletePendingTasks() { |
return did_work; |
} |
-uint64 MessageLoop::GetTaskTraceID(const PendingTask& task) { |
- return (static_cast<uint64>(task.sequence_num) << 32) | |
- ((static_cast<uint64>(reinterpret_cast<intptr_t>(this)) << 32) >> 32); |
-} |
- |
void MessageLoop::ReloadWorkQueue() { |
// We can improve performance of our loading tasks from the incoming queue to |
// |*work_queue| by waiting until the last minute (|*work_queue| is empty) to |