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

Unified Diff: src/lazy/SkDiscardableMemoryPool.h

Issue 112833003: add more tests for discardable caches (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/SkScaledImageCache.cpp ('k') | tests/ImageCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardableMemoryPool.h
diff --git a/src/lazy/SkDiscardableMemoryPool.h b/src/lazy/SkDiscardableMemoryPool.h
index e9f3b04f079019cb064fe77de6b7e2a4f69aa9c2..61bad701825aaa26279d22b4c9f75c7acabfb6a5 100644
--- a/src/lazy/SkDiscardableMemoryPool.h
+++ b/src/lazy/SkDiscardableMemoryPool.h
@@ -12,6 +12,8 @@
#include "SkTInternalLList.h"
#include "SkThread.h"
+class SkPoolDiscardableMemory;
+
#ifdef SK_DEBUG
#define LAZY_CACHE_STATS 1
#elif !defined(LAZY_CACHE_STATS)
@@ -22,20 +24,22 @@
* This non-global pool can be used for unit tests to verify that the
* pool works.
*/
-class SkPoolDiscardableMemory;
class SkDiscardableMemoryPool : public SkDiscardableMemory::Factory {
public:
/**
* Without mutex, will be not be thread safe.
*/
SkDiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = NULL);
- ~SkDiscardableMemoryPool();
- SkDiscardableMemory* create(size_t bytes) SK_OVERRIDE;
+ virtual ~SkDiscardableMemoryPool();
+
+ virtual SkDiscardableMemory* create(size_t bytes) SK_OVERRIDE;
+
size_t getRAMUsed();
void setRAMBudget(size_t budget);
+
/** purges all unlocked DMs */
void dumpPool();
- friend class SkPoolDiscardableMemory;
+
#if LAZY_CACHE_STATS
int fCacheHits;
int fCacheMisses;
@@ -46,6 +50,7 @@ private:
size_t fBudget;
size_t fUsed;
SkTInternalLList<SkPoolDiscardableMemory> fList;
+
/** Function called to free memory if needed */
void dumpDownTo(size_t budget);
/** called by SkDiscardableMemoryPool upon destruction */
@@ -54,6 +59,9 @@ private:
bool lock(SkPoolDiscardableMemory* dm);
/** called by SkDiscardableMemoryPool::unlock() */
void unlock(SkPoolDiscardableMemory* dm);
+
+ friend class SkPoolDiscardableMemory;
+
typedef SkDiscardableMemory::Factory INHERITED;
};
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | tests/ImageCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698