diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/wtf/Partitions.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/wtf/Partitions.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/chromium/third_party/WebKit/Source/wtf/Partitions.cpp b/chromium/third_party/WebKit/Source/wtf/Partitions.cpp index 60b30dbba20..64e3b2f1276 100644 --- a/chromium/third_party/WebKit/Source/wtf/Partitions.cpp +++ b/chromium/third_party/WebKit/Source/wtf/Partitions.cpp @@ -73,18 +73,26 @@ void Partitions::setHistogramEnumeration(HistogramEnumerationFunction histogramE void Partitions::shutdown() { + spinLockLock(&s_initializationLock); + // We could ASSERT here for a memory leak within the partition, but it leads // to very hard to diagnose ASSERTs, so it's best to leave leak checking for // the valgrind and heapcheck bots, which run without partitions. - (void) m_layoutAllocator.shutdown(); - (void) m_nodeAllocator.shutdown(); - (void) m_bufferAllocator.shutdown(); - (void) m_fastMallocAllocator.shutdown(); + if (s_initialized) { + (void) m_layoutAllocator.shutdown(); + (void) m_nodeAllocator.shutdown(); + (void) m_bufferAllocator.shutdown(); + (void) m_fastMallocAllocator.shutdown(); + } + + spinLockUnlock(&s_initializationLock); } void Partitions::decommitFreeableMemory() { - ASSERT(isMainThread()); + RELEASE_ASSERT(isMainThread()); + if (!s_initialized) + return; partitionPurgeMemoryGeneric(bufferPartition(), PartitionPurgeDecommitEmptyPages); partitionPurgeMemoryGeneric(fastMallocPartition(), PartitionPurgeDecommitEmptyPages); |