Index: base/tracked_objects.cc |
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc |
index d24cedf159241d58a92909650de374f187dd85ae..10c3ed8b894e3edd90c0b3a40f3705ff5a192987 100644 |
--- a/base/tracked_objects.cc |
+++ b/base/tracked_objects.cc |
@@ -16,6 +16,7 @@ |
#include "base/process/process_handle.h" |
#include "base/strings/stringprintf.h" |
#include "base/third_party/valgrind/memcheck.h" |
+#include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
#include "base/tracking_info.h" |
#include "build/build_config.h" |
@@ -362,6 +363,14 @@ void ThreadData::InitializeThreadContext(const std::string& suggested_name) { |
return; // Browser tests instigate this. |
current_thread_data = new ThreadData(suggested_name); |
tls_index_.Set(current_thread_data); |
+ |
+ // Add thread name to pseudo stack frame of heap profiler. The name added here |
+ // is valid for the lifetime of the process since ThreadData is not destroyed |
+ // even if thread is dead. |
Primiano Tucci (use gerrit)
2016/03/15 16:44:33
Bad news:
I took a look to this and figured out th
ssid
2016/03/17 00:11:47
I think I should continue with good news and bad n
|
+ if (base::trace_event::AllocationContextTracker::capture_enabled()) { |
+ base::trace_event::AllocationContextTracker::SetThreadName( |
+ tracked_objects::ThreadData::Get()->thread_name().c_str()); |
+ } |
} |
// static |