| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 is_coordinator_(false), | 108 is_coordinator_(false), |
| 108 memory_tracing_enabled_(0), | 109 memory_tracing_enabled_(0), |
| 109 tracing_process_id_(kInvalidTracingProcessId), | 110 tracing_process_id_(kInvalidTracingProcessId), |
| 110 dumper_registrations_ignored_for_testing_(false) { | 111 dumper_registrations_ignored_for_testing_(false) { |
| 111 g_next_guid.GetNext(); // Make sure that first guid is not zero. | 112 g_next_guid.GetNext(); // Make sure that first guid is not zero. |
| 112 | 113 |
| 113 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess() | 114 heap_profiling_enabled_ = CommandLine::InitializedForCurrentProcess() |
| 114 ? CommandLine::ForCurrentProcess()->HasSwitch( | 115 ? CommandLine::ForCurrentProcess()->HasSwitch( |
| 115 switches::kEnableHeapProfiling) | 116 switches::kEnableHeapProfiling) |
| 116 : false; | 117 : false; |
| 118 |
| 119 if (heap_profiling_enabled_) |
| 120 AllocationContextTracker::SetCaptureEnabled(true); |
| 117 } | 121 } |
| 118 | 122 |
| 119 MemoryDumpManager::~MemoryDumpManager() { | 123 MemoryDumpManager::~MemoryDumpManager() { |
| 120 TraceLog::GetInstance()->RemoveEnabledStateObserver(this); | 124 TraceLog::GetInstance()->RemoveEnabledStateObserver(this); |
| 121 } | 125 } |
| 122 | 126 |
| 123 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, | 127 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, |
| 124 bool is_coordinator) { | 128 bool is_coordinator) { |
| 125 { | 129 { |
| 126 AutoLock lock(lock_); | 130 AutoLock lock(lock_); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 next_dump_provider(next_dump_provider), | 518 next_dump_provider(next_dump_provider), |
| 515 callback(callback), | 519 callback(callback), |
| 516 task_runner(MessageLoop::current()->task_runner()) { | 520 task_runner(MessageLoop::current()->task_runner()) { |
| 517 } | 521 } |
| 518 | 522 |
| 519 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { | 523 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { |
| 520 } | 524 } |
| 521 | 525 |
| 522 } // namespace trace_event | 526 } // namespace trace_event |
| 523 } // namespace base | 527 } // namespace base |
| OLD | NEW |