Index: base/trace_event/memory_profiler_allocation_context.cc |
diff --git a/base/trace_event/memory_profiler_allocation_context.cc b/base/trace_event/memory_profiler_allocation_context.cc |
index b82e2109845b0494c82ee7d689aefe5f7a7d960b..ddd74640ea2c98638d2462ad3c1098469e7e8429 100644 |
--- a/base/trace_event/memory_profiler_allocation_context.cc |
+++ b/base/trace_event/memory_profiler_allocation_context.cc |
@@ -6,6 +6,7 @@ |
#include <algorithm> |
+#include "base/macros.h" |
#include "base/threading/thread_local_storage.h" |
namespace base { |
@@ -15,11 +16,24 @@ subtle::Atomic32 AllocationContextTracker::capture_enabled_ = 0; |
namespace { |
ThreadLocalStorage::StaticSlot g_tls_alloc_ctx_tracker = TLS_INITIALIZER; |
-} |
+ |
+} // namespace |
AllocationStack::AllocationStack() {} |
AllocationStack::~AllocationStack() {} |
+AllocationContext AllocationContext::GetEmpty() { |
+ AllocationContext context; |
+ |
+ for (size_t i = 0; i < arraysize(context.backtrace.frames); i++) |
+ context.backtrace.frames[i] = nullptr; |
+ |
+ for (size_t i = 0; i < arraysize(context.fields); i++) |
+ context.fields[i].first = nullptr; |
+ |
+ return context; |
+} |
+ |
// This function is added to the TLS slot to clean up the instance when the |
// thread exits. |
void DestructAllocationContextTracker(void* alloc_ctx_tracker) { |