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/trace_event_memory_overhead.h" | 9 #include "base/trace_event/trace_event_memory_overhead.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | 112 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
113 : m_currentProcessMemoryDump(adoptPtr(new WebProcessMemoryDumpImpl())) | 113 : m_currentProcessMemoryDump(adoptPtr(new WebProcessMemoryDumpImpl())) |
114 , m_isHeapProfilingEnabled(false) | 114 , m_isHeapProfilingEnabled(false) |
115 { | 115 { |
116 } | 116 } |
117 | 117 |
118 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char*
typeName) | 118 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char*
typeName) |
119 { | 119 { |
120 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetContextSnapshot(); | 120 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); |
121 context.type_name = typeName; | 121 context.type_name = typeName; |
122 MutexLocker locker(m_allocationRegisterMutex); | 122 MutexLocker locker(m_allocationRegisterMutex); |
123 if (m_allocationRegister) | 123 if (m_allocationRegister) |
124 m_allocationRegister->Insert(address, size, context); | 124 m_allocationRegister->Insert(address, size, context); |
125 } | 125 } |
126 | 126 |
127 void BlinkGCMemoryDumpProvider::remove(Address address) | 127 void BlinkGCMemoryDumpProvider::remove(Address address) |
128 { | 128 { |
129 MutexLocker locker(m_allocationRegisterMutex); | 129 MutexLocker locker(m_allocationRegisterMutex); |
130 if (m_allocationRegister) | 130 if (m_allocationRegister) |
131 m_allocationRegister->Remove(address); | 131 m_allocationRegister->Remove(address); |
132 } | 132 } |
133 | 133 |
134 } // namespace blink | 134 } // namespace blink |
OLD | NEW |