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

Unified Diff: third_party/WebKit/Source/wtf/Partitions.cpp

Issue 1463683002: Switch wtf/SpinLock to std::atomic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asan iwyu Created 5 years 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 | « third_party/WebKit/Source/wtf/Partitions.h ('k') | third_party/WebKit/Source/wtf/SpinLock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/Partitions.cpp
diff --git a/third_party/WebKit/Source/wtf/Partitions.cpp b/third_party/WebKit/Source/wtf/Partitions.cpp
index 39914b4a9c89e2712cf0ac58fb024839bfaaa612..2e97e011efebd74f183c15f915778ec8ca7b9a0e 100644
--- a/third_party/WebKit/Source/wtf/Partitions.cpp
+++ b/third_party/WebKit/Source/wtf/Partitions.cpp
@@ -39,7 +39,7 @@ namespace WTF {
const char* const Partitions::kAllocatedObjectPoolName = "partition_alloc/allocated_objects";
-int Partitions::s_initializationLock = 0;
+SpinLock Partitions::s_initializationLock;
Primiano Tucci (use gerrit) 2015/12/07 10:11:57 This is now a static initializer, some bots are un
bool Partitions::s_initialized = false;
PartitionAllocatorGeneric Partitions::m_fastMallocAllocator;
@@ -50,7 +50,7 @@ HistogramEnumerationFunction Partitions::m_histogramEnumeration = nullptr;
void Partitions::initialize(HistogramEnumerationFunction histogramEnumeration)
{
- spinLockLock(&s_initializationLock);
+ SpinLock::Guard guard(s_initializationLock);
if (!s_initialized) {
partitionAllocGlobalInit(&Partitions::handleOutOfMemory);
@@ -61,13 +61,11 @@ void Partitions::initialize(HistogramEnumerationFunction histogramEnumeration)
m_histogramEnumeration = histogramEnumeration;
s_initialized = true;
}
-
- spinLockUnlock(&s_initializationLock);
}
void Partitions::shutdown()
{
- spinLockLock(&s_initializationLock);
+ SpinLock::Guard guard(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
@@ -78,8 +76,6 @@ void Partitions::shutdown()
(void) m_bufferAllocator.shutdown();
(void) m_fastMallocAllocator.shutdown();
}
-
- spinLockUnlock(&s_initializationLock);
}
void Partitions::decommitFreeableMemory()
« no previous file with comments | « third_party/WebKit/Source/wtf/Partitions.h ('k') | third_party/WebKit/Source/wtf/SpinLock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698