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/malloc_dump_provider.h" | 5 #include "base/trace_event/malloc_dump_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/allocator/allocator_shim.h" | 10 #include "base/allocator/allocator_shim.h" |
(...skipping 67 matching lines...) Loading... |
78 &HookZeroInitAlloc, /* alloc_zero_initialized_function */ | 78 &HookZeroInitAlloc, /* alloc_zero_initialized_function */ |
79 &HookllocAligned, /* alloc_aligned_function */ | 79 &HookllocAligned, /* alloc_aligned_function */ |
80 &HookRealloc, /* realloc_function */ | 80 &HookRealloc, /* realloc_function */ |
81 &HookFree, /* free_function */ | 81 &HookFree, /* free_function */ |
82 nullptr, /* next */ | 82 nullptr, /* next */ |
83 }; | 83 }; |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) | 86 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
87 | 87 |
| 88 MallocDumpProvider::ScopedHeapProfilerIgnoreMalloc:: |
| 89 ScopedHeapProfilerIgnoreMalloc() { |
| 90 if (UNLIKELY(AllocationContextTracker::capture_enabled())) { |
| 91 AllocationContextTracker::GetInstanceForCurrentThread() |
| 92 ->start_ignore_scope(); |
| 93 } |
| 94 } |
| 95 |
| 96 MallocDumpProvider::ScopedHeapProfilerIgnoreMalloc:: |
| 97 ~ScopedHeapProfilerIgnoreMalloc() { |
| 98 if (UNLIKELY(AllocationContextTracker::capture_enabled())) { |
| 99 AllocationContextTracker::GetInstanceForCurrentThread()->end_ignore_scope(); |
| 100 } |
| 101 } |
| 102 |
88 // static | 103 // static |
89 const char MallocDumpProvider::kAllocatedObjects[] = "malloc/allocated_objects"; | 104 const char MallocDumpProvider::kAllocatedObjects[] = "malloc/allocated_objects"; |
90 | 105 |
91 // static | 106 // static |
92 MallocDumpProvider* MallocDumpProvider::GetInstance() { | 107 MallocDumpProvider* MallocDumpProvider::GetInstance() { |
93 return Singleton<MallocDumpProvider, | 108 return Singleton<MallocDumpProvider, |
94 LeakySingletonTraits<MallocDumpProvider>>::get(); | 109 LeakySingletonTraits<MallocDumpProvider>>::get(); |
95 } | 110 } |
96 | 111 |
97 MallocDumpProvider::MallocDumpProvider() | 112 MallocDumpProvider::MallocDumpProvider() |
(...skipping 154 matching lines...) Loading... |
252 tid_dumping_heap_ == PlatformThread::CurrentId()) | 267 tid_dumping_heap_ == PlatformThread::CurrentId()) |
253 return; | 268 return; |
254 AutoLock lock(allocation_register_lock_); | 269 AutoLock lock(allocation_register_lock_); |
255 if (!allocation_register_) | 270 if (!allocation_register_) |
256 return; | 271 return; |
257 allocation_register_->Remove(address); | 272 allocation_register_->Remove(address); |
258 } | 273 } |
259 | 274 |
260 } // namespace trace_event | 275 } // namespace trace_event |
261 } // namespace base | 276 } // namespace base |
OLD | NEW |