Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 1334523002: Revert of Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/fonts/SkRemotableFontMgr.cpp ('k') | src/opts/opts_check_x86.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
+
+////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/fonts/SkRemotableFontMgr.cpp ('k') | src/opts/opts_check_x86.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698