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

Unified Diff: third_party/WebKit/Source/wtf/PartitionAlloc.cpp

Issue 1391933004: [Tracing] Add hook to PartitionAlloc for heap profiling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address primiano comments Created 5 years, 2 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
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
}

Powered by Google App Engine
This is Rietveld 408576698