Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index ffb1f836d890ef1b1cad7a520d7857e1b75411c5..32562946ed54c2baa82fbd8c2a4e39f35ac814ce 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,19 +560,24 @@ |
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_ONCE_PTR(SkImageFilter::Cache, cache); |
+SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
+ |
SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
- return cache.get([]{ return SkImageFilter::Cache::Create(kDefaultCacheSize); }); |
+ return cache.get(); |
} |
void SkImageFilter::PurgeCache() { |
- Cache::Get()->purge(); |
+ cache.get()->purge(); |
} |
/////////////////////////////////////////////////////////////////////////////////////////////////// |