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

Unified Diff: src/ports/SkMutex_win.h

Issue 364473002: Grant independence to SkBaseMutex on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Even more trivial SkMutex 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkMutex_win.h
diff --git a/src/ports/SkMutex_win.h b/src/ports/SkMutex_win.h
index d12fd033f3d6d6a457d1b9022987572f8be9690f..d84b0e42fd0da5fe0607544c6453001283d62a03 100644
--- a/src/ports/SkMutex_win.h
+++ b/src/ports/SkMutex_win.h
@@ -31,15 +31,17 @@
#endif
// On Windows, SkBaseMutex and SkMutex are the same thing,
-// we can't easily get rid of static initializers.
-class SkMutex {
+// we can't easily get rid of static initializers. However,
+// we preserve the same inheritance pattern as other platforms
+// so that we can forward-declare cleanly.
+struct SkBaseMutex {
public:
- SkMutex() {
+ SkBaseMutex() {
InitializeCriticalSection(&fStorage);
SkDEBUGCODE(fOwner = 0;)
}
- ~SkMutex() {
+ ~SkBaseMutex() {
SkASSERT(0 == fOwner);
DeleteCriticalSection(&fStorage);
}
@@ -59,15 +61,16 @@ public:
SkASSERT(GetCurrentThreadId() == fOwner);
}
-private:
- SkMutex(const SkMutex&);
- SkMutex& operator=(const SkMutex&);
-
+protected:
CRITICAL_SECTION fStorage;
SkDEBUGCODE(DWORD fOwner;)
+
+private:
+ SkBaseMutex(const SkBaseMutex&);
+ SkBaseMutex& operator=(const SkBaseMutex&);
};
-typedef SkMutex SkBaseMutex;
+class SkMutex : public SkBaseMutex { };
// Windows currently provides no documented means of POD initializing a CRITICAL_SECTION.
#define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698