aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrGpuResource.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-10-03 14:07:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-03 14:07:01 -0700
commit0f147ac2ae575bbad3515a526f13700bc5c8e9d7 (patch)
treec5a3f893dec0881746d1d0eeb06a7ad589ac186c /include/gpu/GrGpuResource.h
parente60d85597f803c4dff6329840215af1d1d9a8fdc (diff)
Make GrResourceCache dynamically change between LRU and random replacement strategies.
Random performs significantly better when each frame exceeds the budget by a small margin whereas LRU has worst case behavior. The decision of which to use is made based on the history from a few frames of the ratio of total unique key cache misses to unique key cache misses of resources purged in the last 2 frames. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2321563006 Review-Url: https://codereview.chromium.org/2321563006
Diffstat (limited to 'include/gpu/GrGpuResource.h')
-rw-r--r--include/gpu/GrGpuResource.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 364a886408..6f8280acb2 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -58,6 +58,7 @@ public:
this->validate();
if (!(--fRefCnt)) {
+ SkASSERT(fRefCnt >= 0);
if (!static_cast<const DERIVED*>(this)->notifyRefCountIsZero()) {
return;
}
@@ -117,6 +118,7 @@ private:
private:
void didRemoveRefOrPendingIO(CntType cntTypeRemoved) const {
+ this->validate();
if (0 == fPendingReads && 0 == fPendingWrites && 0 == fRefCnt) {
static_cast<const DERIVED*>(this)->notifyAllCntsAreZero(cntTypeRemoved);
}