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

Unified Diff: Source/wtf/Partitions.h

Issue 1044143002: Oilpan: Centralize Partition allocators into Partitions.h (part 2) (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
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Partitions.h
diff --git a/Source/wtf/Partitions.h b/Source/wtf/Partitions.h
index 4529ba0cd008b8ccede2d06a42842adf253b27e7..eae6d2032002b5341443dda1b6ab8546f4d24760 100644
--- a/Source/wtf/Partitions.h
+++ b/Source/wtf/Partitions.h
@@ -42,21 +42,44 @@ public:
static void shutdown();
ALWAYS_INLINE static PartitionRootGeneric* getBufferPartition()
{
+ // TODO(haraken): This check is needed because some call sites allocate
+ // Blink things before WTF::initialize(). We should fix those call sites
+ // and remove the check.
if (UNLIKELY(!s_initialized))
initialize();
return m_bufferAllocator.root();
}
- ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() { return m_objectModelAllocator.root(); }
- ALWAYS_INLINE static PartitionRoot* getRenderingPartition() { return m_renderingAllocator.root(); }
+ ALWAYS_INLINE static PartitionRootGeneric* getFastMallocPartition()
+ {
+ // TODO(haraken): This check is needed because some call sites allocate
+ // Blink things before WTF::initialize(). We should fix those call sites
+ // and remove the check.
+ if (UNLIKELY(!s_initialized))
+ initialize();
+ return m_fastMallocAllocator.root();
+ }
+
+ ALWAYS_INLINE static PartitionRoot* getObjectModelPartition()
+ {
+ ASSERT(s_initialized);
+ return m_objectModelAllocator.root();
+ }
+ ALWAYS_INLINE static PartitionRoot* getRenderingPartition()
+ {
+ ASSERT(s_initialized);
+ return m_renderingAllocator.root();
+ }
static size_t currentDOMMemoryUsage()
{
+ ASSERT(s_initialized);
return m_objectModelAllocator.root()->totalSizeOfCommittedPages;
}
private:
static bool s_initialized;
+ static PartitionAllocatorGeneric m_fastMallocAllocator;
static PartitionAllocatorGeneric m_bufferAllocator;
static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator;
static SizeSpecificPartitionAllocator<1024> m_renderingAllocator;
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698