Index: base/trace_event/trace_event.h |
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h |
index 7d489aecc26d72700b62685bd0170372eb843122..d5a2e57b2f57d630f3174c7d8c7d7103e1cf4be5 100644 |
--- a/base/trace_event/trace_event.h |
+++ b/base/trace_event/trace_event.h |
@@ -986,13 +986,17 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
ScopedTracer() : p_data_(NULL) {} |
~ScopedTracer() { |
- if (p_data_ && *data_.category_group_enabled) { |
- TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
- data_.category_group_enabled, data_.name, data_.event_handle); |
+ if (data_.name) { |
+ if (p_data_ && *data_.category_group_enabled) { |
+ TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
+ data_.category_group_enabled, data_.name, data_.event_handle); |
+ } |
+ if (data_.initialized_for_profiling) { |
+ base::trace_event::AllocationContextTracker:: |
+ GetInstanceForCurrentThread() |
+ ->PopPseudoStackFrame(data_.name); |
+ } |
} |
- // TODO(ssid): Pop the frame from the pseudo stack if initialized for |
- // profiling is true, after adding profiling mode in skia and Blink |
- // crbug.com/598426. |
} |
void Initialize(const unsigned char* category_group_enabled, |
@@ -1008,8 +1012,8 @@ class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { |
if (!(flags & TRACE_EVENT_FLAG_COPY)) { |
data_.initialized_for_profiling = true; |
data_.name = name; |
- // TODO(ssid): Add the frame to the pseudo stack after adding profiling |
- // mode in skia and Blink crbug.com/598426. |
+ base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
+ ->PushPseudoStackFrame(name); |
} |
} |