Index: Source/wtf/Partitions.cpp |
diff --git a/Source/wtf/Partitions.cpp b/Source/wtf/Partitions.cpp |
index c8f6e7500d803eea15b326e87bbd67075f7f1111..e5110b9d94312975979907ca3b7377f096a85bd9 100644 |
--- a/Source/wtf/Partitions.cpp |
+++ b/Source/wtf/Partitions.cpp |
@@ -38,6 +38,7 @@ |
namespace WTF { |
bool Partitions::s_initialized; |
+int Partitions::s_lock = 0; |
PartitionAllocatorGeneric Partitions::m_fastMallocAllocator; |
PartitionAllocatorGeneric Partitions::m_bufferAllocator; |
@@ -45,20 +46,26 @@ SizeSpecificPartitionAllocator<3328> Partitions::m_objectModelAllocator; |
SizeSpecificPartitionAllocator<1024> Partitions::m_layoutAllocator; |
HistogramEnumerationFunction Partitions::m_histogramEnumeration = nullptr; |
-void Partitions::initialize(HistogramEnumerationFunction histogramEnumeration) |
+void Partitions::initialize() |
{ |
- static int lock = 0; |
// Guard against two threads hitting here in parallel. |
- spinLockLock(&lock); |
+ spinLockLock(&s_lock); |
if (!s_initialized) { |
m_fastMallocAllocator.init(); |
m_bufferAllocator.init(); |
m_objectModelAllocator.init(); |
m_layoutAllocator.init(); |
- m_histogramEnumeration = histogramEnumeration; |
s_initialized = true; |
} |
- spinLockUnlock(&lock); |
+ spinLockUnlock(&s_lock); |
+} |
+ |
+void Partitions::setHistogramEnumeration(HistogramEnumerationFunction histogramEnumeration) |
+{ |
+ spinLockLock(&s_lock); |
haraken
2015/06/17 05:24:20
I don't think this lock is needed. Partitions::set
bashi
2015/06/17 05:25:27
Hmm, the same can be said for initialize()? Can we
haraken
2015/06/17 05:29:37
I think your understanding is correct. Any Blink t
bashi
2015/06/17 05:49:41
Removed. We can't add ASSERT(isMainThread()) becau
|
+ ASSERT(!m_histogramEnumeration); |
+ m_histogramEnumeration = histogramEnumeration; |
+ spinLockUnlock(&s_lock); |
} |
void Partitions::shutdown() |