Fix thread unsafe mutex initialization.

BUG=skia:2779

Committed: https://skia.googlesource.com/skia/+/d6aeb6dc8fe21066f1a2c4813a4256a3acd3edf5

R=robertphillips@google.com, mtklein@google.com, reed@android.com, bsalomon@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/419113002
diff --git a/src/ports/SkMutex_pthread.h b/src/ports/SkMutex_pthread.h
index 3bf3628..9aaa061 100644
--- a/src/ports/SkMutex_pthread.h
+++ b/src/ports/SkMutex_pthread.h
@@ -89,11 +89,13 @@
 #define SK_BASE_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER, SkDEBUGCODE(0) }
 
 // Using POD-style initialization prevents the generation of a static initializer.
+//
 // Without magic statics there are no thread safety guarantees on initialization
-// of local statics (even POD).
-// As a result, it is illegal to SK_DECLARE_STATIC_MUTEX in a function.
-#define SK_DECLARE_STATIC_MUTEX(name) \
-    static inline void SK_MACRO_APPEND_LINE(name)(){} \
-    static SkBaseMutex name = SK_BASE_MUTEX_INIT
+// of local statics (even POD). As a result, it is illegal to use
+// SK_DECLARE_STATIC_MUTEX in a function.
+//
+// Because SkBaseMutex is not a primitive, a static SkBaseMutex cannot be
+// initialized in a class with this macro.
+#define SK_DECLARE_STATIC_MUTEX(name) namespace {} static SkBaseMutex name = SK_BASE_MUTEX_INIT
 
 #endif
diff --git a/src/ports/SkMutex_win.h b/src/ports/SkMutex_win.h
index ccad063..fe06336 100644
--- a/src/ports/SkMutex_win.h
+++ b/src/ports/SkMutex_win.h
@@ -74,8 +74,6 @@
 
 // Windows currently provides no documented means of POD initializing a CRITICAL_SECTION.
 // As a result, it is illegal to SK_DECLARE_STATIC_MUTEX in a function.
-#define SK_DECLARE_STATIC_MUTEX(name) \
-    static inline void SK_MACRO_APPEND_LINE(name)(){} \
-    static SkBaseMutex name
+#define SK_DECLARE_STATIC_MUTEX(name) namespace{} static SkBaseMutex name
 
 #endif