| Index: base/trace_event/heap_profiler_allocation_context_tracker.cc | 
| diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc | 
| index 0aa54a84ed380f8ee7e8f669bd78532041943e14..518792c4a5034b448eb364d13c3b223da147a4dd 100644 | 
| --- a/base/trace_event/heap_profiler_allocation_context_tracker.cc | 
| +++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc | 
| @@ -19,6 +19,7 @@ subtle::Atomic32 AllocationContextTracker::capture_enabled_ = 0; | 
| namespace { | 
|  | 
| const size_t kMaxStackDepth = 128u; | 
| +const size_t kMaxTaskDepth = 16u; | 
| AllocationContextTracker* const kInitializingSentinel = | 
| reinterpret_cast<AllocationContextTracker*>(-1); | 
|  | 
| @@ -51,6 +52,7 @@ AllocationContextTracker::GetInstanceForCurrentThread() { | 
|  | 
| AllocationContextTracker::AllocationContextTracker() : thread_name_(nullptr) { | 
| pseudo_stack_.reserve(kMaxStackDepth); | 
| +  task_contexts_.reserve(kMaxTaskDepth); | 
| } | 
| AllocationContextTracker::~AllocationContextTracker() {} | 
|  | 
| @@ -99,6 +101,20 @@ void AllocationContextTracker::PopPseudoStackFrame(StackFrame frame) { | 
| pseudo_stack_.pop_back(); | 
| } | 
|  | 
| +void AllocationContextTracker::PushCurrentTaskContext(const char* context) { | 
| +  DCHECK(context); | 
| +  if (task_contexts_.size() < kMaxTaskDepth) | 
| +    task_contexts_.push_back(context); | 
| +  else | 
| +    NOTREACHED(); | 
| +} | 
| + | 
| +void AllocationContextTracker::PopCurrentTaskContext(const char* context) { | 
| +  DCHECK_EQ(context, task_contexts_.back()) | 
| +      << "Encountered an unmatched context end"; | 
| +  task_contexts_.pop_back(); | 
| +} | 
| + | 
| // static | 
| AllocationContext AllocationContextTracker::GetContextSnapshot() { | 
| AllocationContext ctx; | 
| @@ -125,7 +141,9 @@ AllocationContext AllocationContextTracker::GetContextSnapshot() { | 
| std::fill(dst, dst_end, nullptr); | 
| } | 
|  | 
| -  ctx.type_name = nullptr; | 
| +  // TODO(ssid): Fix crbug.com/594803 to add file name as 3rd dimension | 
| +  // (component name) in the heap profiler and not piggy back on the type name. | 
| +  ctx.type_name = task_contexts_.empty() ? nullptr : task_contexts_.back(); | 
|  | 
| return ctx; | 
| } | 
|  |