| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // TODO(bashi): Change type name of |absoluteName|. | 108 // TODO(bashi): Change type name of |absoluteName|. |
| 109 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d
ata()); | 109 return m_currentProcessMemoryDump->CreateAllocatorDump(absoluteName.utf8().d
ata()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC() | 112 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC() |
| 113 { | 113 { |
| 114 m_currentProcessMemoryDump->Clear(); | 114 m_currentProcessMemoryDump->Clear(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | 117 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
| 118 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt
r)) | 118 : m_currentProcessMemoryDump(new base::trace_event::ProcessMemoryDump(nullpt
r, { base::trace_event::MemoryDumpLevelOfDetail::DETAILED })) |
| 119 , m_isHeapProfilingEnabled(false) | 119 , m_isHeapProfilingEnabled(false) |
| 120 { | 120 { |
| 121 } | 121 } |
| 122 | 122 |
| 123 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char*
typeName) | 123 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char*
typeName) |
| 124 { | 124 { |
| 125 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); | 125 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); |
| 126 context.type_name = typeName; | 126 context.type_name = typeName; |
| 127 MutexLocker locker(m_allocationRegisterMutex); | 127 MutexLocker locker(m_allocationRegisterMutex); |
| 128 if (m_allocationRegister) | 128 if (m_allocationRegister) |
| 129 m_allocationRegister->Insert(address, size, context); | 129 m_allocationRegister->Insert(address, size, context); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void BlinkGCMemoryDumpProvider::remove(Address address) | 132 void BlinkGCMemoryDumpProvider::remove(Address address) |
| 133 { | 133 { |
| 134 MutexLocker locker(m_allocationRegisterMutex); | 134 MutexLocker locker(m_allocationRegisterMutex); |
| 135 if (m_allocationRegister) | 135 if (m_allocationRegister) |
| 136 m_allocationRegister->Remove(address); | 136 m_allocationRegister->Remove(address); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace blink | 139 } // namespace blink |
| OLD | NEW |