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

Unified Diff: Source/wtf/PartitionAlloc.cpp

Issue 1315113006: Add partitionsOutOfMemoryUsingXXX to know Blink memory usage from OOM crash reports (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 3 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 | « Source/wtf/PartitionAlloc.h ('k') | Source/wtf/Partitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PartitionAlloc.cpp
diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp
index d14559485d97aa50051843fc2c46b32762e0f7f5..d076568fcfc59bd6984d319884c0c6c19b18d6af 100644
--- a/Source/wtf/PartitionAlloc.cpp
+++ b/Source/wtf/PartitionAlloc.cpp
@@ -59,6 +59,7 @@ int PartitionRootBase::gInitializedLock = 0;
bool PartitionRootBase::gInitialized = false;
PartitionPage PartitionRootBase::gSeedPage;
PartitionBucket PartitionRootBase::gPagedBucket;
+void (*PartitionRootBase::gOomHandlingFunction)() = nullptr;
static uint16_t partitionBucketNumSystemPages(size_t size)
{
@@ -138,6 +139,12 @@ static void partitionBucketInitBase(PartitionBucket* bucket, PartitionRootBase*
bucket->numSystemPagesPerSlotSpan = partitionBucketNumSystemPages(bucket->slotSize);
}
+void partitionAllocGlobalInit(void (*oomHandlingFunction)())
+{
+ ASSERT(oomHandlingFunction);
+ PartitionRootBase::gOomHandlingFunction = oomHandlingFunction;
+}
+
void partitionAllocInit(PartitionRoot* root, size_t numBuckets, size_t maxAllocation)
{
partitionAllocBaseInit(root);
@@ -308,6 +315,8 @@ static NEVER_INLINE void partitionOutOfMemory(const PartitionRootBase* root)
partitionOutOfMemoryWithLotsOfUncommitedPages();
}
#endif
+ if (PartitionRootBase::gOomHandlingFunction)
+ (*PartitionRootBase::gOomHandlingFunction)();
IMMEDIATE_CRASH();
}
« no previous file with comments | « Source/wtf/PartitionAlloc.h ('k') | Source/wtf/Partitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698