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, 7 insertions, 5 deletions
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 1f3bcf93e9..6ced5bfc02 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 "SkOncePtr.h"
+#include "SkOnce.h"
#include "SkTInternalLList.h"
// Note:
@@ -246,11 +246,13 @@ SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMute
}
SK_DECLARE_STATIC_MUTEX(gMutex);
-SK_DECLARE_STATIC_ONCE_PTR(SkDiscardableMemoryPool, global);
SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() {
- return global.get([] {
- return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE,
- &gMutex);
+ static SkOnce once;
+ static SkDiscardableMemoryPool* global;
+ once([]{
+ global = SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE,
+ &gMutex);
});
+ return global;
}