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

Unified Diff: include/core/SkThread.h

Issue 155963003: SkOnce in is_lcd_supported instead of hand rolled double-checked locking. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SK -> Sk Created 6 years, 10 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 | « include/core/SkOnce.h ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkThread.h
diff --git a/include/core/SkThread.h b/include/core/SkThread.h
index 160b40ce29863d5978e8a715436976ed26f6ed2b..7e2c90ed519295d2f3d0a526c684a6034d3e5669 100644
--- a/include/core/SkThread.h
+++ b/include/core/SkThread.h
@@ -51,35 +51,6 @@ static void sk_membar_acquire__after_atomic_conditional_inc();
#include SK_ATOMICS_PLATFORM_H
-// This is POD and must be zero-initialized.
-struct SkSpinlock {
- void acquire() {
- SkASSERT(shouldBeZero == 0);
- // No memory barrier needed, but sk_atomic_cas gives us at least release anyway.
- while (!sk_atomic_cas(&thisIsPrivate, 0, 1)) {
- // spin
- }
- }
-
- void release() {
- SkASSERT(shouldBeZero == 0);
- // This requires a release memory barrier before storing, which sk_atomic_cas guarantees.
- SkAssertResult(sk_atomic_cas(&thisIsPrivate, 1, 0));
- }
-
- int32_t thisIsPrivate;
- SkDEBUGCODE(int32_t shouldBeZero;)
-};
-
-class SkAutoSpinlock : SkNoncopyable {
-public:
- explicit SkAutoSpinlock(SkSpinlock* lock) : fLock(lock) { fLock->acquire(); }
- ~SkAutoSpinlock() { fLock->release(); }
-private:
- SkSpinlock* fLock;
-};
-#define SkAutoSpinlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoSpinlock)
-
/** SK_MUTEX_PLATFORM_H must provide the following (or equivalent) declarations.
class SkBaseMutex {
« no previous file with comments | « include/core/SkOnce.h ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698