Improvements/additions to SkImageCache/SkLazyPixelRef.
SkPurgeableImageCache:
New image cache that uses virtual memory to store the pixels. Combines
features of SkAshmemImageCache (which has been removed) with SkPurgeableMemoryBlock, which has android and Mac versions.
SkImageCache:
Modified the API. pinCache now returns a status out parameter which
states whether the pinned memory retained the old data. This allows
allocAndPinCache to only be used for allocations.
Add a new debug only interface to purge unpinned data.
Updates to documentation, clarifying behavior.
Changed CachedStatus to MemoryStatus
SkLruImageCache:
Implement the new function purgeAllUnpinnedCaches and change implementation
of pinCache for the new behavior.
SkLazyPixelRef:
Rewrite onLockPixels to account for the new behavior of pinCache.
BitmapFactoryTest:
Test the new SkPurgeableImageCache.
Write tests which directly test the SkImageCaches.
Create a larger bitmap, since some of the SkImageCaches are designed
to handle large bitmaps.
bench_ and render_pictures:
Consolidate lazy_decode_bitmap into one function.
Allow using a flag to specify using the purgeable image cache.
Clean up some #includes.
Review URL: https://codereview.chromium.org/12433020
git-svn-id: http://skia.googlecode.com/svn/trunk@8207 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/lazy/SkLruImageCache.h b/include/lazy/SkLruImageCache.h
index 05d2815..f655230 100644
--- a/include/lazy/SkLruImageCache.h
+++ b/include/lazy/SkLruImageCache.h
@@ -25,7 +25,8 @@
virtual ~SkLruImageCache();
#ifdef SK_DEBUG
- CacheStatus getCacheStatus(intptr_t ID) const SK_OVERRIDE;
+ virtual MemoryStatus getMemoryStatus(intptr_t ID) const SK_OVERRIDE;
+ virtual void purgeAllUnpinnedCaches() SK_OVERRIDE;
#endif
/**
@@ -45,7 +46,7 @@
size_t getImageCacheUsed() const { return fRamUsed; }
virtual void* allocAndPinCache(size_t bytes, intptr_t* ID) SK_OVERRIDE;
- virtual void* pinCache(intptr_t ID) SK_OVERRIDE;
+ virtual void* pinCache(intptr_t ID, SkImageCache::DataStatus*) SK_OVERRIDE;
virtual void releaseCache(intptr_t ID) SK_OVERRIDE;
virtual void throwAwayCache(intptr_t ID) SK_OVERRIDE;
@@ -55,7 +56,7 @@
typedef SkTInternalLList<CachedPixels>::Iter Iter;
#ifdef SK_DEBUG
- // fMutex is mutable so that getCacheStatus can be const
+ // fMutex is mutable so that getMemoryStatus can be const
mutable
#endif
SkMutex fMutex;