Chromium Code Reviews| 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 53532b231242ff567e07486f680c1819cf6bb092..43b4fb8e017dbaa353aae959ddeabe2b7e597416 100644 |
| --- a/base/trace_event/memory_dump_manager.cc |
| +++ b/base/trace_event/memory_dump_manager.cc |
| @@ -169,7 +169,30 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() { |
| switches::kEnableHeapProfiling)) |
| return; |
| - AllocationContextTracker::SetCaptureEnabled(true); |
| + std::string profiling_mode = CommandLine::ForCurrentProcess() |
| + ->GetSwitchValueASCII(switches::kEnableHeapProfiling); |
| + bool profiling_mode_parsed = false; |
| + if (profiling_mode == "") { |
| + AllocationContextTracker::SetCaptureMode( |
| + AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
| + profiling_mode_parsed = true; |
| + } |
| +#if ENABLE_NATIVE_ALLOCATION_TRACES |
| + else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { |
| + AllocationContextTracker::SetCaptureMode( |
| + AllocationContextTracker::CaptureMode::NATIVE_STACK); |
| + profiling_mode_parsed = true; |
| + } |
| +#endif |
| + if (!profiling_mode_parsed) { |
| + LOG(ERROR) << "Ignored unknown mode '" << profiling_mode << "' for " |
|
Primiano Tucci (use gerrit)
2016/04/19 20:15:19
there is a discussion on chromium-dev about LOG. T
Dmitry Skiba
2016/04/20 19:19:25
Done.
|
| + << switches::kEnableHeapProfiling << " flag."; |
| + |
| + // Enable pseudo stacks |
| + AllocationContextTracker::SetCaptureMode( |
| + AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
| + } |
| + |
| for (auto mdp : dump_providers_) |
| mdp->dump_provider->OnHeapProfilingEnabled(true); |
| heap_profiling_enabled_ = true; |