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

Unified Diff: src/core/SkSharedMutex.h

Issue 1285973003: Add asserts for shared mutex. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add SkDebug guards Created 5 years, 4 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 | « no previous file | src/core/SkSharedMutex.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSharedMutex.h
diff --git a/src/core/SkSharedMutex.h b/src/core/SkSharedMutex.h
index a3535dca430aad26b26ab33dc5ef4018609e96df..f3430040e38b51ee05ddb9d2915db44a30ff6ec3 100644
--- a/src/core/SkSharedMutex.h
+++ b/src/core/SkSharedMutex.h
@@ -28,16 +28,31 @@ public:
// Release lock for exclusive use.
void release();
+ // Fail if exclusive is not held.
+#ifdef SK_DEBUG
+ void assertHeld() const;
+#else
+ void assertHeld() const {}
+#endif
+
// Acquire lock for shared use.
void acquireShared();
// Release lock for shared use.
void releaseShared();
+ // Fail if shared lock not held.
+#ifdef SK_DEBUG
+ void assertHeldShared() const;
+#else
+ void assertHeldShared() const {}
+#endif
+
private:
SkAtomic<int32_t> fQueueCounts;
SkSemaphore fSharedQueue;
SkSemaphore fExclusiveQueue;
};
+
#endif // SkSharedLock_DEFINED
« no previous file with comments | « no previous file | src/core/SkSharedMutex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698