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

Unified Diff: include/core/SkThread.h

Issue 313823004: Add assertHeld() to SkMutex. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 6 years, 6 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/SkPaint.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 3038e2d9542325503295f7603fd60b45b4fca80f..4f7f326097297d3e54af718073ccce9378f543d6 100644
--- a/include/core/SkThread.h
+++ b/include/core/SkThread.h
@@ -83,8 +83,9 @@ template <typename T> void sk_release_store(T*, T);
class SkBaseMutex {
public:
- void acquire();
- void release();
+ void acquire(); // Block until this thread owns the mutex.
+ void release(); // Assuming this thread owns the mutex, release it.
+ void assertHeld(); // If SK_DEBUG, assert this thread owns the mutex.
};
class SkMutex : SkBaseMutex {
@@ -128,6 +129,12 @@ public:
}
}
+ /** Assert that we're holding the mutex. */
+ void assertHeld() {
+ SkASSERT(fMutex);
+ fMutex->assertHeld();
+ }
+
private:
SkBaseMutex* fMutex;
};
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698