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

Unified Diff: Source/wtf/Partitions.cpp

Issue 1234823002: PartitionAlloc: Add a lock to Partitions::initialize() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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/Partitions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Partitions.cpp
diff --git a/Source/wtf/Partitions.cpp b/Source/wtf/Partitions.cpp
index 8ad9931e127445ccdaa81da22289d7688721d64d..6c2b8da2495d5171ecdeaf3eaea1e2c5bf022635 100644
--- a/Source/wtf/Partitions.cpp
+++ b/Source/wtf/Partitions.cpp
@@ -37,7 +37,8 @@
namespace WTF {
-bool Partitions::s_initialized;
+int Partitions::s_initializationLock = 0;
+bool Partitions::s_initialized = false;
PartitionAllocatorGeneric Partitions::m_fastMallocAllocator;
PartitionAllocatorGeneric Partitions::m_bufferAllocator;
@@ -47,6 +48,8 @@ HistogramEnumerationFunction Partitions::m_histogramEnumeration = nullptr;
void Partitions::initialize()
{
+ spinLockLock(&s_initializationLock);
+
if (!s_initialized) {
m_fastMallocAllocator.init();
m_bufferAllocator.init();
@@ -54,6 +57,8 @@ void Partitions::initialize()
m_layoutAllocator.init();
s_initialized = true;
}
+
+ spinLockUnlock(&s_initializationLock);
}
void Partitions::setHistogramEnumeration(HistogramEnumerationFunction histogramEnumeration)
« no previous file with comments | « Source/wtf/Partitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698