| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (heap_profiling_enabled_) | 203 if (heap_profiling_enabled_) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 if (!CommandLine::InitializedForCurrentProcess() || | 206 if (!CommandLine::InitializedForCurrentProcess() || |
| 207 !CommandLine::ForCurrentProcess()->HasSwitch( | 207 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 208 switches::kEnableHeapProfiling)) | 208 switches::kEnableHeapProfiling)) |
| 209 return; | 209 return; |
| 210 | 210 |
| 211 std::string profiling_mode = CommandLine::ForCurrentProcess() | 211 std::string profiling_mode = CommandLine::ForCurrentProcess() |
| 212 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); | 212 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); |
| 213 if (profiling_mode == "") { | 213 if (profiling_mode == switches::kEnableHeapProfilingModePseudo) { |
| 214 AllocationContextTracker::SetCaptureMode( | 214 AllocationContextTracker::SetCaptureMode( |
| 215 AllocationContextTracker::CaptureMode::PSEUDO_STACK); | 215 AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
| 216 #if !defined(OS_NACL) | 216 #if !defined(OS_NACL) |
| 217 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { | 217 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { |
| 218 // If we don't have frame pointers then native tracing falls-back to | 218 // If we don't have frame pointers then native tracing falls-back to |
| 219 // using base::debug::StackTrace, which may be slow. | 219 // using base::debug::StackTrace, which may be slow. |
| 220 AllocationContextTracker::SetCaptureMode( | 220 AllocationContextTracker::SetCaptureMode( |
| 221 AllocationContextTracker::CaptureMode::NATIVE_STACK); | 221 AllocationContextTracker::CaptureMode::NATIVE_STACK); |
| 222 #endif // !defined(OS_NACL) | 222 #endif // !defined(OS_NACL) |
| 223 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) | 223 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 if (iter == process_dumps.end()) { | 941 if (iter == process_dumps.end()) { |
| 942 std::unique_ptr<ProcessMemoryDump> new_pmd( | 942 std::unique_ptr<ProcessMemoryDump> new_pmd( |
| 943 new ProcessMemoryDump(session_state, dump_args)); | 943 new ProcessMemoryDump(session_state, dump_args)); |
| 944 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 944 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 945 } | 945 } |
| 946 return iter->second.get(); | 946 return iter->second.get(); |
| 947 } | 947 } |
| 948 | 948 |
| 949 } // namespace trace_event | 949 } // namespace trace_event |
| 950 } // namespace base | 950 } // namespace base |
| OLD | NEW |