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

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

Issue 1502023002: Revert of Switch wtf/SpinLock to std::atomic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: third_party/WebKit/Source/wtf/SpinLock.cpp
diff --git a/third_party/WebKit/Source/wtf/SpinLock.cpp b/third_party/WebKit/Source/wtf/SpinLock.cpp
index c85203b72d297b79bfe409f5d3d06168e2844807..542f97be672d9daa58242adadf775ff4bf0491a8 100644
--- a/third_party/WebKit/Source/wtf/SpinLock.cpp
+++ b/third_party/WebKit/Source/wtf/SpinLock.cpp
@@ -53,7 +53,7 @@
namespace WTF {
-void SpinLock::lockSlow()
+void slowSpinLockLock(int volatile* lock)
{
// The value of kYieldProcessorTries is cargo culted from TCMalloc, Windows
// critical section defaults, and various other recommendations.
@@ -64,14 +64,14 @@
for (int count = 0; count < kYieldProcessorTries; ++count) {
// Let the Processor know we're spinning.
YIELD_PROCESSOR;
- if (!m_lock.load(std::memory_order_relaxed) && LIKELY(!m_lock.exchange(true, std::memory_order_acq_rel)))
+ if (!*lock && LIKELY(!atomicTestAndSetToOne(lock)))
return;
}
// Give the OS a chance to schedule something on this core.
YIELD_THREAD;
- } while (m_lock.load(std::memory_order_relaxed));
- } while (UNLIKELY(m_lock.exchange(true, std::memory_order_acq_rel)));
+ } while (*lock);
+ } while (UNLIKELY(atomicTestAndSetToOne(lock)));
}
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/SpinLock.h ('k') | third_party/WebKit/Source/wtf/text/TextEncodingRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698