| 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 "platform/heap/BlinkGCMemoryDumpProvider.h" | 5 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
| 6 | 6 |
| 7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 8 #include "base/trace_event/heap_profiler_allocation_register.h" | 8 #include "base/trace_event/heap_profiler_allocation_register.h" |
| 9 #include "base/trace_event/memory_allocator_dump.h" | 9 #include "base/trace_event/memory_allocator_dump.h" |
| 10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | 121 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
| 122 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump( | 122 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump( |
| 123 nullptr, | 123 nullptr, |
| 124 {base::trace_event::MemoryDumpLevelOfDetail::DETAILED})), | 124 {base::trace_event::MemoryDumpLevelOfDetail::DETAILED})), |
| 125 m_isHeapProfilingEnabled(false) {} | 125 m_isHeapProfilingEnabled(false) {} |
| 126 | 126 |
| 127 void BlinkGCMemoryDumpProvider::insert(Address address, | 127 void BlinkGCMemoryDumpProvider::insert(Address address, |
| 128 size_t size, | 128 size_t size, |
| 129 const char* typeName) { | 129 const char* typeName) { |
| 130 base::trace_event::AllocationContext context = | 130 base::trace_event::AllocationContext context; |
| 131 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 131 if (!base::trace_event::AllocationContextTracker:: |
| 132 ->GetContextSnapshot(); | 132 GetInstanceForCurrentThread() |
| 133 ->GetContextSnapshot(&context)) |
| 134 return; |
| 133 context.type_name = typeName; | 135 context.type_name = typeName; |
| 134 MutexLocker locker(m_allocationRegisterMutex); | 136 MutexLocker locker(m_allocationRegisterMutex); |
| 135 if (m_allocationRegister) | 137 if (m_allocationRegister) |
| 136 m_allocationRegister->Insert(address, size, context); | 138 m_allocationRegister->Insert(address, size, context); |
| 137 } | 139 } |
| 138 | 140 |
| 139 void BlinkGCMemoryDumpProvider::remove(Address address) { | 141 void BlinkGCMemoryDumpProvider::remove(Address address) { |
| 140 MutexLocker locker(m_allocationRegisterMutex); | 142 MutexLocker locker(m_allocationRegisterMutex); |
| 141 if (m_allocationRegister) | 143 if (m_allocationRegister) |
| 142 m_allocationRegister->Remove(address); | 144 m_allocationRegister->Remove(address); |
| 143 } | 145 } |
| 144 | 146 |
| 145 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |