aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBrian Salomon <bsalomon@google.com>2019-01-24 12:18:33 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2019-01-25 14:13:00 +0000
commit9bc76d96f986081ab8733c7afced17c4d77f9e8c (patch)
treed157e1cc98bf43e47968398f1dd43f8fcd6eb845 /include
parenta7cb690dc8feccf212b321c15da9a377146a000c (diff)
downloadskqp-9bc76d96f986081ab8733c7afced17c4d77f9e8c.tar.gz
Change the meaning of GrBudgetedType::kUnbudgetedUncacheable.
kUnbudgetedCacheable now means that the resource is never purged until its unique key is removed. This fixes an issue where a cached texture for a promise image might get purged by cache pressure. This in turn could cause Skia to call the promise image's Fulfill proc multiple times with no intervening Release calls. The balancing Release calls would occur, but the policy is that each Fulfill should be balanced by Release *before* another Fulfill. Update/add unit tests. Bug: chromium:922851 Change-Id: I6411e413b3104721ca4bb6e7f07b3b73d14cbcf9 Reviewed-on: https://skia-review.googlesource.com/c/186361 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrGpuResource.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 4ea206ff5c..fd7ead5b6c 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -37,7 +37,7 @@ class SkTraceMemoryDump;
* morphism using CRTP). Similarly when the ref (but not necessarily pending read/write) count
* reaches 0 DERIVED::notifyRefCountIsZero() will be called. In the case when an unref() causes both
* the ref cnt to reach zero and the other counts are zero, notifyRefCountIsZero() will be called
- * before notifyIsPurgeable(). Moreover, if notifyRefCountIsZero() returns false then
+ * before notifyAllCntsAreZero(). Moreover, if notifyRefCountIsZero() returns false then
* notifyAllRefCntsAreZero() won't be called at all. notifyRefCountIsZero() must return false if the
* object may be deleted after notifyRefCntIsZero() returns.
*
@@ -298,7 +298,8 @@ protected:
private:
- bool isPurgeable() const { return !this->internalHasRef() && !this->internalHasPendingIO(); }
+ bool isPurgeable() const;
+ bool hasRefOrPendingIO() const;
/**
* Called by the registerWithCache if the resource is available to be used as scratch.
@@ -306,7 +307,7 @@ private:
* resources and populate the scratchKey with the key.
* By default resources are not recycled as scratch.
**/
- virtual void computeScratchKey(GrScratchKey*) const { }
+ virtual void computeScratchKey(GrScratchKey*) const {}
/**
* Frees the object in the underlying 3D API. Called by CacheAccess.
@@ -316,9 +317,9 @@ private:
virtual size_t onGpuMemorySize() const = 0;
/**
- * Called by GrResourceCache when a resource transitions from being unpurgeable to purgeable.
+ * Called by GrResourceCache when a resource loses its last ref or pending IO.
*/
- virtual void becamePurgeable() {}
+ virtual void removedLastRefOrPendingIO() {}
// See comments in CacheAccess and ResourcePriv.
void setUniqueKey(const GrUniqueKey&);