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/PartitionAllocMemoryDumpProvider.h" | 5 #include "platform/PartitionAllocMemoryDumpProvider.h" |
6 | 6 |
7 #include "base/trace_event/heap_profiler_allocation_context.h" | 7 #include "base/trace_event/heap_profiler_allocation_context.h" |
8 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 8 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
9 #include "base/trace_event/heap_profiler_allocation_register.h" | 9 #include "base/trace_event/heap_profiler_allocation_register.h" |
10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 PartitionAllocHooks::setFreeHook(reportFree); | 163 PartitionAllocHooks::setFreeHook(reportFree); |
164 } else { | 164 } else { |
165 PartitionAllocHooks::setAllocationHook(nullptr); | 165 PartitionAllocHooks::setAllocationHook(nullptr); |
166 PartitionAllocHooks::setFreeHook(nullptr); | 166 PartitionAllocHooks::setFreeHook(nullptr); |
167 } | 167 } |
168 m_isHeapProfilingEnabled = enabled; | 168 m_isHeapProfilingEnabled = enabled; |
169 } | 169 } |
170 | 170 |
171 void PartitionAllocMemoryDumpProvider::insert(void* address, size_t size, const
char* typeName) | 171 void PartitionAllocMemoryDumpProvider::insert(void* address, size_t size, const
char* typeName) |
172 { | 172 { |
173 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetContextSnapshot(); | 173 base::trace_event::AllocationContext context = base::trace_event::Allocation
ContextTracker::GetInstanceForCurrentThread()->GetContextSnapshot(); |
174 context.type_name = typeName; | 174 context.type_name = typeName; |
175 MutexLocker locker(m_allocationRegisterMutex); | 175 MutexLocker locker(m_allocationRegisterMutex); |
176 if (m_allocationRegister) | 176 if (m_allocationRegister) |
177 m_allocationRegister->Insert(address, size, context); | 177 m_allocationRegister->Insert(address, size, context); |
178 } | 178 } |
179 | 179 |
180 void PartitionAllocMemoryDumpProvider::remove(void* address) | 180 void PartitionAllocMemoryDumpProvider::remove(void* address) |
181 { | 181 { |
182 MutexLocker locker(m_allocationRegisterMutex); | 182 MutexLocker locker(m_allocationRegisterMutex); |
183 if (m_allocationRegister) | 183 if (m_allocationRegister) |
184 m_allocationRegister->Remove(address); | 184 m_allocationRegister->Remove(address); |
185 } | 185 } |
186 | 186 |
187 } // namespace blink | 187 } // namespace blink |
OLD | NEW |