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

Unified Diff: Source/wtf/Partitions.cpp

Issue 1041103002: PartitionAlloc: Centralize Partition allocators into one place (Part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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: Source/wtf/Partitions.cpp
diff --git a/Source/wtf/WTF.cpp b/Source/wtf/Partitions.cpp
similarity index 83%
rename from Source/wtf/WTF.cpp
rename to Source/wtf/Partitions.cpp
index d199fbe5fa7a4255611224d20faa5206f8284af3..196ca9c7b12b1b3186c008d8804ea0592ce4c4c8 100644
--- a/Source/wtf/WTF.cpp
+++ b/Source/wtf/Partitions.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "WTF.h"
+#include "wtf/Partitions.h"
#include "wtf/DefaultAllocator.h"
#include "wtf/FastMalloc.h"
@@ -41,7 +41,10 @@ extern void initializeThreading();
bool s_initialized;
bool s_shutdown;
bool Partitions::s_initialized;
+
PartitionAllocatorGeneric Partitions::m_bufferAllocator;
+SizeSpecificPartitionAllocator<3328> Partitions::m_objectModelAllocator;
+SizeSpecificPartitionAllocator<1024> Partitions::m_renderingAllocator;
void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncreasingTimeFunction)
{
@@ -76,6 +79,8 @@ void Partitions::initialize()
spinLockLock(&lock);
if (!s_initialized) {
m_bufferAllocator.init();
+ m_objectModelAllocator.init();
+ m_renderingAllocator.init();
s_initialized = true;
}
spinLockUnlock(&lock);
@@ -84,6 +89,12 @@ void Partitions::initialize()
void Partitions::shutdown()
{
fastMallocShutdown();
+
+ // 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_renderingAllocator.shutdown();
+ (void) m_objectModelAllocator.shutdown();
m_bufferAllocator.shutdown();
Chris Evans 2015/03/30 18:41:36 Nit: we're also ignoring a fairly useful return co
haraken 2015/03/30 23:06:18 Done.
}

Powered by Google App Engine
This is Rietveld 408576698