| 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/trace_event/memory_dump_provider.h" | 14 #include "base/trace_event/memory_dump_provider.h" |
| 15 #include "base/trace_event/memory_dump_session_state.h" | 15 #include "base/trace_event/memory_dump_session_state.h" |
| 16 #include "base/trace_event/memory_profiler_allocation_context.h" |
| 16 #include "base/trace_event/process_memory_dump.h" | 17 #include "base/trace_event/process_memory_dump.h" |
| 17 #include "base/trace_event/trace_event_argument.h" | 18 #include "base/trace_event/trace_event_argument.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 | 20 |
| 20 #if !defined(OS_NACL) | 21 #if !defined(OS_NACL) |
| 21 #include "base/trace_event/process_memory_totals_dump_provider.h" | 22 #include "base/trace_event/process_memory_totals_dump_provider.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 #if defined(OS_LINUX) || defined(OS_ANDROID) | 25 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 25 #include "base/trace_event/malloc_dump_provider.h" | 26 #include "base/trace_event/malloc_dump_provider.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 is_coordinator_(false), | 110 is_coordinator_(false), |
| 110 memory_tracing_enabled_(0), | 111 memory_tracing_enabled_(0), |
| 111 tracing_process_id_(kInvalidTracingProcessId), | 112 tracing_process_id_(kInvalidTracingProcessId), |
| 112 skip_core_dumpers_auto_registration_for_testing_(false) { | 113 skip_core_dumpers_auto_registration_for_testing_(false) { |
| 113 g_next_guid.GetNext(); // Make sure that first guid is not zero. | 114 g_next_guid.GetNext(); // Make sure that first guid is not zero. |
| 114 | 115 |
| 115 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess() | 116 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess() |
| 116 ? CommandLine::ForCurrentProcess()->HasSwitch( | 117 ? CommandLine::ForCurrentProcess()->HasSwitch( |
| 117 switches::kEnableHeapProfiling) | 118 switches::kEnableHeapProfiling) |
| 118 : false; | 119 : false; |
| 120 |
| 121 if (heap_profiling_enabled_) |
| 122 AllocationContextTracker::SetCaptureEnabled(true); |
| 119 } | 123 } |
| 120 | 124 |
| 121 MemoryDumpManager::~MemoryDumpManager() { | 125 MemoryDumpManager::~MemoryDumpManager() { |
| 122 TraceLog::GetInstance()->RemoveEnabledStateObserver(this); | 126 TraceLog::GetInstance()->RemoveEnabledStateObserver(this); |
| 123 } | 127 } |
| 124 | 128 |
| 125 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, | 129 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, |
| 126 bool is_coordinator) { | 130 bool is_coordinator) { |
| 127 { | 131 { |
| 128 AutoLock lock(lock_); | 132 AutoLock lock(lock_); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 next_dump_provider(next_dump_provider), | 519 next_dump_provider(next_dump_provider), |
| 516 callback(callback), | 520 callback(callback), |
| 517 task_runner(MessageLoop::current()->task_runner()) { | 521 task_runner(MessageLoop::current()->task_runner()) { |
| 518 } | 522 } |
| 519 | 523 |
| 520 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { | 524 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { |
| 521 } | 525 } |
| 522 | 526 |
| 523 } // namespace trace_event | 527 } // namespace trace_event |
| 524 } // namespace base | 528 } // namespace base |
| OLD | NEW |