Index: src/lazy/SkDiscardableMemoryPool.cpp |
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp |
index d6753def9d2263e84bc8d156c0e317616b5d4025..2be4c755f1e0c3196fbc13a439333c7cdeadd55f 100644 |
--- a/src/lazy/SkDiscardableMemoryPool.cpp |
+++ b/src/lazy/SkDiscardableMemoryPool.cpp |
@@ -9,7 +9,7 @@ |
#include "SkDiscardableMemoryPool.h" |
#include "SkImageGenerator.h" |
#include "SkMutex.h" |
-#include "SkOnce.h" |
+#include "SkOncePtr.h" |
#include "SkTInternalLList.h" |
// Note: |
@@ -245,13 +245,11 @@ |
} |
SK_DECLARE_STATIC_MUTEX(gMutex); |
+SK_DECLARE_STATIC_ONCE_PTR(SkDiscardableMemoryPool, global); |
SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() { |
- static SkOnce once; |
- static SkDiscardableMemoryPool* global; |
- once([]{ |
- global = SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE, |
- &gMutex); |
+ return global.get([] { |
+ return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE, |
+ &gMutex); |
}); |
- return global; |
-} |
+} |