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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name 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/core/SkGlyphCache.cpp ('k') | src/core/SkMessageBus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 32562946ed54c2baa82fbd8c2a4e39f35ac814ce..ffb1f836d890ef1b1cad7a520d7857e1b75411c5 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -11,9 +11,9 @@
#include "SkBitmapDevice.h"
#include "SkChecksum.h"
#include "SkDevice.h"
-#include "SkLazyPtr.h"
#include "SkMatrixImageFilter.h"
#include "SkMutex.h"
+#include "SkOncePtr.h"
#include "SkReadBuffer.h"
#include "SkRect.h"
#include "SkTDynamicHash.h"
@@ -560,24 +560,19 @@ private:
mutable SkMutex fMutex;
};
-SkImageFilter::Cache* CreateCache() {
- return SkImageFilter::Cache::Create(kDefaultCacheSize);
-}
-
} // namespace
SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) {
return new CacheImpl(maxBytes);
}
-SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache);
-
+SK_DECLARE_STATIC_ONCE_PTR(SkImageFilter::Cache, cache);
SkImageFilter::Cache* SkImageFilter::Cache::Get() {
- return cache.get();
+ return cache.get([]{ return SkImageFilter::Cache::Create(kDefaultCacheSize); });
}
void SkImageFilter::PurgeCache() {
- cache.get()->purge();
+ Cache::Get()->purge();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | src/core/SkMessageBus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698