| 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 5ae7460e2f78fbeb530f8b5e659e0e9cd2baf7da..4ff8d5da9a15227e2dcecac14836530c249090ed 100644
|
| --- a/base/trace_event/memory_dump_manager.cc
|
| +++ b/base/trace_event/memory_dump_manager.cc
|
| @@ -170,7 +170,26 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
|
| switches::kEnableHeapProfiling))
|
| return;
|
|
|
| - AllocationContextTracker::SetCaptureEnabled(true);
|
| + std::string profiling_mode = CommandLine::ForCurrentProcess()
|
| + ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
|
| + if (profiling_mode == "") {
|
| + AllocationContextTracker::SetCaptureMode(
|
| + AllocationContextTracker::CaptureMode::PSEUDO_STACK);
|
| + }
|
| + else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
|
| +#if ENABLE_NATIVE_ALLOCATION_TRACES
|
| + AllocationContextTracker::SetCaptureMode(
|
| + AllocationContextTracker::CaptureMode::NATIVE_STACK);
|
| +#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.";
|
| + }
|
| +
|
| for (auto mdp : dump_providers_)
|
| mdp->dump_provider->OnHeapProfilingEnabled(true);
|
| heap_profiling_enabled_ = true;
|
|
|