Fix thread unsafe mutex initialization.
BUG=skia:2779
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/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 5014c35..48904fa 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -570,6 +570,7 @@
return fCache;
}
+SK_DECLARE_STATIC_MUTEX(gGradientCacheMutex);
/*
* Because our caller might rebuild the same (logically the same) gradient
* over and over, we'd like to return exactly the same "bitmap" if possible,
@@ -605,11 +606,10 @@
///////////////////////////////////
- SK_DECLARE_STATIC_MUTEX(gMutex);
static SkBitmapCache* gCache;
// each cache cost 1K of RAM, since each bitmap will be 1x256 at 32bpp
static const int MAX_NUM_CACHED_GRADIENT_BITMAPS = 32;
- SkAutoMutexAcquire ama(gMutex);
+ SkAutoMutexAcquire ama(gGradientCacheMutex);
if (NULL == gCache) {
gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));