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

Unified Diff: base/tracked_objects.cc

Issue 1784133002: [tracing] Adding task information to heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use SetThreadName function. Created 4 years, 9 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/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

Powered by Google App Engine
This is Rietveld 408576698