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

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: 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..7e90531ed066f85433a8b6f5017155f9810b16af 100644
--- a/include/lazy/SkLruImageCache.h
+++ b/include/lazy/SkLruImageCache.h
@@ -28,8 +28,21 @@ public:
CacheStatus getCacheStatus(intptr_t ID) const SK_OVERRIDE;
#endif
reed1 2013/03/04 20:07:27 existing API naming we use for font cache. Maybe w
scroggo 2013/03/04 20:49:29 Done. Currently, we do not have a notion like the
+ /**
+ * Set the budget. If more bytes are used than this, the cache will free unpinned memory until
+ * under the new budget or until all unpinned memory is freed. This will never free pinned
+ * memory, so the cache can potentially remain over budget. The budget is enforced each time
+ * memory is allocated or released.
+ * 0 is a special flag for an infinite budget.
+ */
void setBudget(size_t newBudget);
+ /**
+ * Return the amount of memory currently in use by the cache. Can include memory that is no
+ * longer pinned, but has not been freed.
+ */
+ size_t getRamUsed() const { return fRamUsed; }
+
virtual void* allocAndPinCache(size_t bytes, intptr_t* ID) SK_OVERRIDE;
virtual void* pinCache(intptr_t ID) SK_OVERRIDE;
virtual void releaseCache(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