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

Unified Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 1953533002: SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hide sk_num_cores() Created 4 years, 7 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 2be4c755f1e0c3196fbc13a439333c7cdeadd55f..d6753def9d2263e84bc8d156c0e317616b5d4025 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:
@@ -245,11 +245,13 @@ SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkMutex* m
}
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;
}
« 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