Chromium Code Reviews| Index: include/core/SkThread.h |
| diff --git a/include/core/SkThread.h b/include/core/SkThread.h |
| index 3038e2d9542325503295f7603fd60b45b4fca80f..27180dbcca5e8c57a2f8657aa36ed1d1ccc7034b 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(); // Assert this thread owns the mutex. |
|
reed1
2014/06/09 19:55:09
// What does this do in release mode?
mtklein
2014/06/09 19:57:32
Nothing. Updated the comment that it's only activ
|
| }; |
| class SkMutex : SkBaseMutex { |
| @@ -128,6 +129,12 @@ public: |
| } |
| } |
| + /** Assert that we're holding the mutex. */ |
| + void assertHeld() { |
| + SkASSERT(fMutex); |
| + fMutex->assertHeld(); |
| + } |
| + |
| private: |
| SkBaseMutex* fMutex; |
| }; |