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

Unified Diff: base/trace_event/trace_log.cc

Issue 1368993002: Reland of "Add thread-local allocation context for tracing" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address primiano comment Created 5 years, 3 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
Index: base/trace_event/trace_log.cc
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 13815b306cb15911c43ed98453094c7916e783db..af7cf4406863461ba1eb05e04f2e5a9dd444602f 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -27,6 +27,7 @@
#include "base/time/time.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
+#include "base/trace_event/memory_profiler_allocation_context.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_buffer.h"
#include "base/trace_event/trace_event.h"
@@ -1320,6 +1321,15 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp(
}
}
+ if (base::trace_event::AllocationContextTracker::capture_enabled()) {
+ if (phase == TRACE_EVENT_PHASE_BEGIN || phase == TRACE_EVENT_PHASE_COMPLETE)
+ base::trace_event::AllocationContextTracker::PushPseudoStackFrame(name);
+ else if (phase == TRACE_EVENT_PHASE_END)
+ // The pop for |TRACE_EVENT_PHASE_COMPLETE| events
+ // is in |TraceLog::UpdateTraceEventDuration|.
+ base::trace_event::AllocationContextTracker::PopPseudoStackFrame(name);
+ }
+
return handle;
}
@@ -1425,6 +1435,11 @@ void TraceLog::UpdateTraceEventDuration(
console_message =
EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event);
}
+
+ if (base::trace_event::AllocationContextTracker::capture_enabled()) {
+ // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|.
+ base::trace_event::AllocationContextTracker::PopPseudoStackFrame(name);
+ }
}
if (console_message.size())
« base/trace_event/memory_profiler_allocation_context.cc ('K') | « base/trace_event/trace_event.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698