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

Unified Diff: src/core/SkResourceCache.h

Issue 936423002: Revert of notify resource caches when pixelref genID goes stale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « src/core/SkPixelRef.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkResourceCache.h
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 36ca27cd7327765c3b74cab1d779dfb0dc77890f..88ccb87ed88443ece5f5b6113fe737f142935713 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -35,8 +35,6 @@
// length must be a multiple of 4
void init(void* nameSpace, size_t length);
- void* getNamespace() const { return fNamespace; }
-
// This is only valid after having called init().
uint32_t hash() const { return fHash; }
@@ -94,21 +92,7 @@
* true, then the Rec is considered "valid". If false is returned, the Rec will be considered
* "stale" and will be purged from the cache.
*/
- typedef bool (*FindVisitor)(const Rec&, void* context);
-
- enum PurgeVisitorResult {
- kRetainAndContinue_PurgeVisitorResult,
- kPurgeAndContinue_PurgeVisitorResult,
- kRetainAndStop_PurgeVisitorResult,
- kPurgeAndStop_PurgeVisitorResult,
- };
-
- /**
- * Callback function for purge(). If called, the cache will have found a match for the
- * specified Key, and will pass in the corresponding Rec, along with a caller-specified
- * context. The function can read the data in Rec.
- */
- typedef PurgeVisitorResult (*PurgeVisitor)(const Rec&, void* context);
+ typedef bool (*VisitorProc)(const Rec&, void* context);
/**
* Returns a locked/pinned SkDiscardableMemory instance for the specified
@@ -130,7 +114,7 @@
* true : Rec is valid
* false : Rec is "stale" -- the cache will purge it.
*/
- static bool Find(const Key& key, FindVisitor, void* context);
+ static bool Find(const Key& key, VisitorProc, void* context);
static void Add(Rec*);
static size_t GetTotalBytesUsed();
@@ -140,12 +124,6 @@
static size_t SetSingleAllocationByteLimit(size_t);
static size_t GetSingleAllocationByteLimit();
static size_t GetEffectiveSingleAllocationByteLimit();
-
- /**
- * Visit all Rec that match the specified namespace, and purge entries as indicated by the
- * visitor.
- */
- static void Purge(const void* nameSpace, PurgeVisitor, void* context);
static void PurgeAll();
@@ -196,7 +174,7 @@
* true : Rec is valid
* false : Rec is "stale" -- the cache will purge it.
*/
- bool find(const Key&, FindVisitor, void* context);
+ bool find(const Key&, VisitorProc, void* context);
void add(Rec*);
size_t getTotalBytesUsed() const { return fTotalBytesUsed; }
@@ -220,12 +198,8 @@
*/
size_t setTotalByteLimit(size_t newLimit);
- void purge(const void* nameSpace, PurgeVisitor, void* context);
-
void purgeAll() {
- fInsidePurgeAllCounter += 1;
this->purgeAsNeeded(true);
- fInsidePurgeAllCounter -= 1;
}
DiscardableFactory discardableFactory() const { return fDiscardableFactory; }
@@ -253,12 +227,6 @@
size_t fTotalByteLimit;
size_t fSingleAllocationByteLimit;
int fCount;
-
- bool insidePurgeAll() const {
- SkASSERT(fInsidePurgeAllCounter >= 0);
- return fInsidePurgeAllCounter > 0;
- }
- int fInsidePurgeAllCounter;
void purgeAsNeeded(bool forcePurge = false);
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698