| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 15 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 16 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 16 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
| 17 #include "base/trace_event/malloc_dump_provider.h" | 17 #include "base/trace_event/malloc_dump_provider.h" |
| 18 #include "base/trace_event/memory_dump_provider.h" | 18 #include "base/trace_event/memory_dump_provider.h" |
| 19 #include "base/trace_event/memory_dump_session_state.h" | 19 #include "base/trace_event/memory_dump_session_state.h" |
| 20 #include "base/trace_event/process_memory_dump.h" | 20 #include "base/trace_event/process_memory_dump.h" |
| 21 #include "base/trace_event/trace_event_argument.h" | 21 #include "base/trace_event/trace_event_argument.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 | 23 |
| 24 #if !defined(OS_NACL) | |
| 25 #include "base/trace_event/process_memory_totals_dump_provider.h" | |
| 26 #endif | |
| 27 | |
| 28 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
| 29 #include "base/trace_event/process_memory_maps_dump_provider.h" | |
| 30 #endif | |
| 31 | |
| 32 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 33 #include "base/trace_event/java_heap_dump_provider_android.h" | 25 #include "base/trace_event/java_heap_dump_provider_android.h" |
| 34 #endif | 26 #endif |
| 35 | 27 |
| 36 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 37 #include "base/trace_event/winheap_dump_provider_win.h" | 29 #include "base/trace_event/winheap_dump_provider_win.h" |
| 38 #endif | 30 #endif |
| 39 | 31 |
| 40 namespace base { | 32 namespace base { |
| 41 namespace trace_event { | 33 namespace trace_event { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 bool is_coordinator) { | 140 bool is_coordinator) { |
| 149 { | 141 { |
| 150 AutoLock lock(lock_); | 142 AutoLock lock(lock_); |
| 151 DCHECK(delegate); | 143 DCHECK(delegate); |
| 152 DCHECK(!delegate_); | 144 DCHECK(!delegate_); |
| 153 delegate_ = delegate; | 145 delegate_ = delegate; |
| 154 is_coordinator_ = is_coordinator; | 146 is_coordinator_ = is_coordinator; |
| 155 } | 147 } |
| 156 | 148 |
| 157 // Enable the core dump providers. | 149 // Enable the core dump providers. |
| 158 #if !defined(OS_NACL) | |
| 159 RegisterDumpProvider(ProcessMemoryTotalsDumpProvider::GetInstance(), | |
| 160 "ProcessMemoryTotals", nullptr); | |
| 161 #endif | |
| 162 | |
| 163 #if defined(MALLOC_MEMORY_TRACING_SUPPORTED) | 150 #if defined(MALLOC_MEMORY_TRACING_SUPPORTED) |
| 164 RegisterDumpProvider(MallocDumpProvider::GetInstance(), "Malloc", nullptr); | 151 RegisterDumpProvider(MallocDumpProvider::GetInstance(), "Malloc", nullptr); |
| 165 #endif | 152 #endif |
| 166 | 153 |
| 167 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
| 168 RegisterDumpProvider(ProcessMemoryMapsDumpProvider::GetInstance(), | |
| 169 "ProcessMemoryMaps", nullptr); | |
| 170 #endif | |
| 171 | |
| 172 #if defined(OS_ANDROID) | 154 #if defined(OS_ANDROID) |
| 173 RegisterDumpProvider(JavaHeapDumpProvider::GetInstance(), "JavaHeap", | 155 RegisterDumpProvider(JavaHeapDumpProvider::GetInstance(), "JavaHeap", |
| 174 nullptr); | 156 nullptr); |
| 175 #endif | 157 #endif |
| 176 | 158 |
| 177 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
| 178 RegisterDumpProvider(WinHeapDumpProvider::GetInstance(), "WinHeap", nullptr); | 160 RegisterDumpProvider(WinHeapDumpProvider::GetInstance(), "WinHeap", nullptr); |
| 179 #endif | 161 #endif |
| 180 | 162 |
| 181 // If tracing was enabled before initializing MemoryDumpManager, we missed the | 163 // If tracing was enabled before initializing MemoryDumpManager, we missed the |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 auto iter = process_dumps.find(pid); | 653 auto iter = process_dumps.find(pid); |
| 672 if (iter == process_dumps.end()) { | 654 if (iter == process_dumps.end()) { |
| 673 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); | 655 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); |
| 674 iter = process_dumps.insert(pid, new_pmd.Pass()).first; | 656 iter = process_dumps.insert(pid, new_pmd.Pass()).first; |
| 675 } | 657 } |
| 676 return iter->second; | 658 return iter->second; |
| 677 } | 659 } |
| 678 | 660 |
| 679 } // namespace trace_event | 661 } // namespace trace_event |
| 680 } // namespace base | 662 } // namespace base |
| OLD | NEW |