aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkResourceCache.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2015-02-19 08:53:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-19 08:53:52 -0800
commit90c6bc4e85df2da37f436ea1da203e194c4740e2 (patch)
treebc71dc3d3a7160bb8118a1e349e11a6e58a4b8cb /src/core/SkResourceCache.h
parentcabc08c4296e1ce6c6d9d84cf702361cf439c1bc (diff)
Revert of notify resource caches when pixelref genID goes stale (patchset #4 id:60001 of https://codereview.chromium.org/825263005/)
Reason for revert: Crazy failures. http://build.chromium.org/p/client.skia/builders/Test-Mac10.8-MacMini4.1-GeForce320M-x86_64-Debug/builds/1428/steps/dm/logs/stdio Original issue's description: > notify resource caches when pixelref genID goes stale > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/4675819b9dbb3ad71ec851776e5de26d342f29fe TBR=bsalomon@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/936423002
Diffstat (limited to 'src/core/SkResourceCache.h')
-rw-r--r--src/core/SkResourceCache.h38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 36ca27cd73..88ccb87ed8 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -35,8 +35,6 @@ public:
// 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 @@ public:
* 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 @@ public:
* 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();
@@ -141,12 +125,6 @@ public:
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 @@ public:
* 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 @@ public:
*/
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; }
@@ -254,12 +228,6 @@ private:
size_t fSingleAllocationByteLimit;
int fCount;
- bool insidePurgeAll() const {
- SkASSERT(fInsidePurgeAllCounter >= 0);
- return fInsidePurgeAllCounter > 0;
- }
- int fInsidePurgeAllCounter;
-
void purgeAsNeeded(bool forcePurge = false);
// linklist management