Index: src/ports/SkMutex_win.h |
diff --git a/src/ports/SkMutex_win.h b/src/ports/SkMutex_win.h |
index f4b8234e85d70305ee28deb634158ae703a0734d..d12fd033f3d6d6a457d1b9022987572f8be9690f 100644 |
--- a/src/ports/SkMutex_win.h |
+++ b/src/ports/SkMutex_win.h |
@@ -36,25 +36,35 @@ class SkMutex { |
public: |
SkMutex() { |
InitializeCriticalSection(&fStorage); |
+ SkDEBUGCODE(fOwner = 0;) |
} |
~SkMutex() { |
+ SkASSERT(0 == fOwner); |
DeleteCriticalSection(&fStorage); |
} |
void acquire() { |
EnterCriticalSection(&fStorage); |
+ SkDEBUGCODE(fOwner = GetCurrentThreadId();) |
} |
void release() { |
+ this->assertHeld(); |
+ SkDEBUGCODE(fOwner = 0;) |
LeaveCriticalSection(&fStorage); |
} |
+ void assertHeld() { |
+ SkASSERT(GetCurrentThreadId() == fOwner); |
+ } |
+ |
private: |
SkMutex(const SkMutex&); |
SkMutex& operator=(const SkMutex&); |
CRITICAL_SECTION fStorage; |
+ SkDEBUGCODE(DWORD fOwner;) |
}; |
typedef SkMutex SkBaseMutex; |