| 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();
|
| }
|
|
|
|
|