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

Unified Diff: include/lazy/SkLruImageCache.h

Issue 12378075: Provide an option in bench_pictures to count pixel ram. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Use the logger rather than debug statements. Created 7 years, 10 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 | « gm/factory.cpp ('k') | src/lazy/SkLruImageCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/lazy/SkLruImageCache.h
diff --git a/include/lazy/SkLruImageCache.h b/include/lazy/SkLruImageCache.h
index 44446000cdf0f96370c8ecbed5cbe40a555d8b89..05d28150b0b3f9ffa83cf296b0da066e3e8f21fe 100644
--- a/include/lazy/SkLruImageCache.h
+++ b/include/lazy/SkLruImageCache.h
@@ -28,7 +28,21 @@ public:
CacheStatus getCacheStatus(intptr_t ID) const SK_OVERRIDE;
#endif
- void setBudget(size_t newBudget);
+ /**
+ * Set the byte limit on cached pixels. If more bytes are used than this, the cache will free
+ * unpinned memory until under the new limit or until all unpinned memory is freed. This will
+ * never free pinned memory, so the cache can potentially remain over the limit. The limit is
+ * enforced each time memory is allocated or released.
+ * 0 is a special flag for an infinite budget.
+ * @return size_t The previous limit.
+ */
+ size_t setImageCacheLimit(size_t newLimit);
+
+ /**
+ * Return the number of bytes of memory currently in use by the cache. Can include memory that
+ * is no longer pinned, but has not been freed.
+ */
+ 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;
« no previous file with comments | « gm/factory.cpp ('k') | src/lazy/SkLruImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698