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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2695013005: Only enable heap tracking under --enable-heap-profiling=task-profiler. (Closed)
Patch Set: Created 3 years, 10 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_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 246a5aadcafddcd92ca15c4e96e871fc5763905c..24db511b50280259bc64b1cce287fe407119a8cd 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -14,6 +14,7 @@
#include "base/compiler_specific.h"
#include "base/debug/debugging_flags.h"
#include "base/debug/stack_trace.h"
+#include "base/debug/thread_heap_usage_tracker.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -199,6 +200,17 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
<< switches::kEnableHeapProfiling << " flag is not supported "
<< "for this platform / build type.";
#endif
+ } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) {
+#if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
Primiano Tucci (use gerrit) 2017/02/15 14:18:03 I'd probably put the #if around the "else if", so
Sigurður Ásgeirsson 2017/02/15 15:35:45 Done.
+ // Enable heap tracking, which in turn enables capture of heap usage
+ // tracking in tracked_objects.cc.
+ if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled())
+ base::debug::ThreadHeapUsageTracker::EnableHeapTracking();
+#else
+ CHECK(false) << "'" << profiling_mode << "' mode for "
+ << switches::kEnableHeapProfiling << " flag is not supported "
+ << "for this platform / build type.";
+#endif
} else {
CHECK(false) << "Invalid mode '" << profiling_mode << "' for "
<< switches::kEnableHeapProfiling << " flag.";
« base/base_switches.cc ('K') | « base/base_switches.cc ('k') | base/tracked_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698