aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lazy
diff options
context:
space:
mode:
Diffstat (limited to 'src/lazy')
-rw-r--r--src/lazy/SkDiscardableMemoryPool.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 6ced5bfc02..1f3bcf93e9 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:
@@ -246,13 +246,11 @@ SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMute
}
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;
}