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

Unified Diff: third_party/WebKit/Source/platform/heap/Heap.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/Heap.h
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h
index ece92caea837aa5036b5d79afb5fb0db6638b29d..eb9fcd65483886526b4e4c94166a16c37f1e0419 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.h
+++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -48,17 +48,17 @@ namespace blink {
class PLATFORM_EXPORT HeapAllocHooks {
public:
// TODO(hajimehoshi): Pass a type name of the allocated object.
- typedef void AllocationHook(Address, size_t);
+ typedef void AllocationHook(Address, size_t, const char*);
typedef void FreeHook(Address);
static void setAllocationHook(AllocationHook* hook) { m_allocationHook = hook; }
static void setFreeHook(FreeHook* hook) { m_freeHook = hook; }
- static void allocationHookIfEnabled(Address address, size_t size)
+ static void allocationHookIfEnabled(Address address, size_t size, const char* typeName)
{
AllocationHook* allocationHook = m_allocationHook;
if (UNLIKELY(!!allocationHook))
- allocationHook(address, size);
+ allocationHook(address, size, typeName);
}
static void freeHookIfEnabled(Address address)
@@ -68,14 +68,14 @@ public:
freeHook(address);
}
- static void reallocHookIfEnabled(Address oldAddress, Address newAddress, size_t size)
+ static void reallocHookIfEnabled(Address oldAddress, Address newAddress, size_t size, const char* typeName)
{
// Report a reallocation as a free followed by an allocation.
AllocationHook* allocationHook = m_allocationHook;
FreeHook* freeHook = m_freeHook;
if (UNLIKELY(allocationHook && freeHook)) {
freeHook(oldAddress);
- allocationHook(newAddress, size);
+ allocationHook(newAddress, size, typeName);
}
}
@@ -496,7 +496,8 @@ Address Heap::allocate(size_t size, bool eagerlySweep)
{
ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
Address address = Heap::allocateOnHeapIndex(state, size, eagerlySweep ? BlinkGC::EagerSweepHeapIndex : Heap::heapIndexForObjectSize(size), GCInfoTrait<T>::index());
- HeapAllocHooks::allocationHookIfEnabled(address, size);
+ const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T);
+ HeapAllocHooks::allocationHookIfEnabled(address, size, typeName);
return address;
}
@@ -530,7 +531,8 @@ Address Heap::reallocate(void* previous, size_t size)
if (copySize > size)
copySize = size;
memcpy(address, previous, copySize);
- HeapAllocHooks::reallocHookIfEnabled(static_cast<Address>(previous), address, size);
+ const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T);
+ HeapAllocHooks::reallocHookIfEnabled(static_cast<Address>(previous), address, size, typeName);
return address;
}
« no previous file with comments | « third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698