| Index: src/lazy/SkDiscardableMemoryPool.cpp
|
| diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
|
| index 78c48f50c158f25ea90a87300e9c6bddc9816d3d..17b8c23d950503ac360954fcae2824c47920371d 100644
|
| --- a/src/lazy/SkDiscardableMemoryPool.cpp
|
| +++ b/src/lazy/SkDiscardableMemoryPool.cpp
|
| @@ -8,8 +8,8 @@
|
| #include "SkDiscardableMemory.h"
|
| #include "SkDiscardableMemoryPool.h"
|
| #include "SkImageGenerator.h"
|
| +#include "SkLazyPtr.h"
|
| #include "SkMutex.h"
|
| -#include "SkOncePtr.h"
|
| #include "SkTInternalLList.h"
|
|
|
| // Note:
|
| @@ -246,18 +246,23 @@
|
| this->dumpDownTo(0);
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +SK_DECLARE_STATIC_MUTEX(gMutex);
|
| +SkDiscardableMemoryPool* create_global_pool() {
|
| + return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE,
|
| + &gMutex);
|
| +}
|
| +
|
| } // namespace
|
|
|
| SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkBaseMutex* mutex) {
|
| return new DiscardableMemoryPool(size, mutex);
|
| }
|
|
|
| -SK_DECLARE_STATIC_MUTEX(gMutex);
|
| -SK_DECLARE_STATIC_ONCE_PTR(SkDiscardableMemoryPool, global);
|
| +SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool);
|
|
|
| SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() {
|
| - return global.get([] {
|
| - return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE,
|
| - &gMutex);
|
| - });
|
| -}
|
| + return global.get();
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
|
|