Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp

Issue 2637783002: [tracing] Don't register tracing-related allocations. (Closed)
Patch Set: Fix unittest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/heap_profiler_allocation_context.h" 8 #include "base/trace_event/heap_profiler_allocation_context.h"
9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
10 #include "base/trace_event/heap_profiler_allocation_register.h" 10 #include "base/trace_event/heap_profiler_allocation_register.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } else { 193 } else {
194 WTF::PartitionAllocHooks::SetAllocationHook(nullptr); 194 WTF::PartitionAllocHooks::SetAllocationHook(nullptr);
195 WTF::PartitionAllocHooks::SetFreeHook(nullptr); 195 WTF::PartitionAllocHooks::SetFreeHook(nullptr);
196 } 196 }
197 m_isHeapProfilingEnabled = enabled; 197 m_isHeapProfilingEnabled = enabled;
198 } 198 }
199 199
200 void PartitionAllocMemoryDumpProvider::insert(void* address, 200 void PartitionAllocMemoryDumpProvider::insert(void* address,
201 size_t size, 201 size_t size,
202 const char* typeName) { 202 const char* typeName) {
203 base::trace_event::AllocationContext context = 203 base::trace_event::AllocationContext context;
204 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() 204 if (!base::trace_event::AllocationContextTracker::
205 ->GetContextSnapshot(); 205 GetInstanceForCurrentThread()
206 ->GetContextSnapshot(&context))
207 return;
208
206 context.type_name = typeName; 209 context.type_name = typeName;
207 MutexLocker locker(m_allocationRegisterMutex); 210 MutexLocker locker(m_allocationRegisterMutex);
208 if (m_allocationRegister) 211 if (m_allocationRegister)
209 m_allocationRegister->Insert(address, size, context); 212 m_allocationRegister->Insert(address, size, context);
210 } 213 }
211 214
212 void PartitionAllocMemoryDumpProvider::remove(void* address) { 215 void PartitionAllocMemoryDumpProvider::remove(void* address) {
213 MutexLocker locker(m_allocationRegisterMutex); 216 MutexLocker locker(m_allocationRegisterMutex);
214 if (m_allocationRegister) 217 if (m_allocationRegister)
215 m_allocationRegister->Remove(address); 218 m_allocationRegister->Remove(address);
216 } 219 }
217 220
218 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698