Index: third_party/WebKit/Source/wtf/PartitionAlloc.cpp |
diff --git a/third_party/WebKit/Source/wtf/PartitionAlloc.cpp b/third_party/WebKit/Source/wtf/PartitionAlloc.cpp |
index d076568fcfc59bd6984d319884c0c6c19b18d6af..54dbe72e1a3a5023d72ae72706eb333f8f8d279f 100644 |
--- a/third_party/WebKit/Source/wtf/PartitionAlloc.cpp |
+++ b/third_party/WebKit/Source/wtf/PartitionAlloc.cpp |
@@ -60,6 +60,8 @@ bool PartitionRootBase::gInitialized = false; |
PartitionPage PartitionRootBase::gSeedPage; |
PartitionBucket PartitionRootBase::gPagedBucket; |
void (*PartitionRootBase::gOomHandlingFunction)() = nullptr; |
+PartitionAllocHooks::AllocationHook* PartitionAllocHooks::m_allocationHook = nullptr; |
+PartitionAllocHooks::FreeHook* PartitionAllocHooks::m_freeHook = nullptr; |
static uint16_t partitionBucketNumSystemPages(size_t size) |
{ |
@@ -1060,8 +1062,10 @@ void* partitionReallocGeneric(PartitionRootGeneric* root, void* ptr, size_t newS |
// We may be able to perform the realloc in place by changing the |
// accessibility of memory pages and, if reducing the size, decommitting |
// them. |
- if (partitionReallocDirectMappedInPlace(root, page, newSize)) |
+ if (partitionReallocDirectMappedInPlace(root, page, newSize)) { |
+ PartitionAllocHooks::maybeInvokeReallocationHook(ptr, ptr, newSize); |
return ptr; |
+ } |
} |
size_t actualNewSize = partitionAllocActualSize(root, newSize); |
@@ -1085,6 +1089,9 @@ void* partitionReallocGeneric(PartitionRootGeneric* root, void* ptr, size_t newS |
memcpy(ret, ptr, copySize); |
partitionFreeGeneric(root, ptr); |
+ |
+ PartitionAllocHooks::maybeInvokeReallocationHook(ptr, ret, newSize); |
+ |
return ret; |
#endif |
} |