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

Side by Side Diff: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 1711643002: Show type names in Oilpan heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue-585063-impl-hooks
Patch Set: Created 4 years, 10 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/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 13 matching lines...) Expand all
24 allocatorDump->addScalar("size", "bytes", Heap::allocatedSpace()); 24 allocatorDump->addScalar("size", "bytes", Heap::allocatedSpace());
25 25
26 dumpName.append("/allocated_objects"); 26 dumpName.append("/allocated_objects");
27 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump( dumpName); 27 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump( dumpName);
28 28
29 // Heap::markedObjectSize() can be underestimated if we're still in the 29 // Heap::markedObjectSize() can be underestimated if we're still in the
30 // process of lazy sweeping. 30 // process of lazy sweeping.
31 objectsDump->addScalar("size", "bytes", Heap::allocatedObjectSize() + Heap:: markedObjectSize()); 31 objectsDump->addScalar("size", "bytes", Heap::allocatedObjectSize() + Heap:: markedObjectSize());
32 } 32 }
33 33
34 void reportAllocation(Address address, size_t size) 34 void reportAllocation(Address address, size_t size, const char* typeName)
35 { 35 {
36 BlinkGCMemoryDumpProvider::instance()->insert(address, size); 36 BlinkGCMemoryDumpProvider::instance()->insert(address, size, typeName);
37 } 37 }
38 38
39 void reportFree(Address address) 39 void reportFree(Address address)
40 { 40 {
41 BlinkGCMemoryDumpProvider::instance()->remove(address); 41 BlinkGCMemoryDumpProvider::instance()->remove(address);
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() 46 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance()
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 { 107 {
108 m_currentProcessMemoryDump->clear(); 108 m_currentProcessMemoryDump->clear();
109 } 109 }
110 110
111 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() 111 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider()
112 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo ryDump())) 112 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo ryDump()))
113 , m_isHeapProfilingEnabled(false) 113 , m_isHeapProfilingEnabled(false)
114 { 114 {
115 } 115 }
116 116
117 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size) 117 void BlinkGCMemoryDumpProvider::insert(Address address, size_t size, const char* typeName)
118 { 118 {
119 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetContextSnapshot(); 119 base::trace_event::AllocationContext context = base::trace_event::Allocation ContextTracker::GetContextSnapshot();
120 // TODO(hajimehoshi): Implement to use a correct type name. 120 context.type_name = typeName;
121 context.type_name = "";
122 MutexLocker locker(m_allocationRegisterMutex); 121 MutexLocker locker(m_allocationRegisterMutex);
123 if (m_allocationRegister) 122 if (m_allocationRegister)
124 m_allocationRegister->Insert(address, size, context); 123 m_allocationRegister->Insert(address, size, context);
125 } 124 }
126 125
127 void BlinkGCMemoryDumpProvider::remove(Address address) 126 void BlinkGCMemoryDumpProvider::remove(Address address)
128 { 127 {
129 MutexLocker locker(m_allocationRegisterMutex); 128 MutexLocker locker(m_allocationRegisterMutex);
130 if (m_allocationRegister) 129 if (m_allocationRegister)
131 m_allocationRegister->Remove(address); 130 m_allocationRegister->Remove(address);
132 } 131 }
133 132
134 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.h ('k') | third_party/WebKit/Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698