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

Unified Diff: base/trace_event/memory_profiler_allocation_context.cc

Issue 1391933004: [Tracing] Add hook to PartitionAlloc for heap profiling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address primiano comments Created 5 years, 2 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/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) {

Powered by Google App Engine
This is Rietveld 408576698