Add explicit abandoned flag to the GrProxyProvider

In the DDL world it is valid for the GrProxyProvider to not have a
GrResourceProvider so we need a separate marker for abandonment.

Change-Id: Iae18a25226d35e1152a902e17a8091e0058695f3
Reviewed-on: https://skia-review.googlesource.com/97220
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2018-01-19 13:22:07 -05:00 committed by Skia Commit-Bot
parent bd4bfa8a6e
commit 4d12051d35
2 changed files with 9 additions and 2 deletions

View File

@ -28,6 +28,7 @@ GrProxyProvider::GrProxyProvider(GrResourceProvider* resourceProvider,
GrSingleOwner* owner)
: fResourceProvider(resourceProvider)
, fResourceCache(resourceCache)
, fAbandoned(false)
, fCaps(caps)
#ifdef SK_DEBUG
, fSingleOwner(owner)

View File

@ -183,11 +183,16 @@ public:
void abandon() {
fResourceCache = nullptr;
fResourceProvider = nullptr;
fAbandoned = true;
}
bool isAbandoned() const {
SkASSERT(SkToBool(fResourceCache) == SkToBool(fResourceProvider));
return !SkToBool(fResourceCache);
#ifdef SK_DEBUG
if (fAbandoned) {
SkASSERT(!fResourceCache && !fResourceProvider);
}
#endif
return fAbandoned;
}
int numUniqueKeyProxies_TestOnly() const;
@ -212,6 +217,7 @@ private:
GrResourceProvider* fResourceProvider;
GrResourceCache* fResourceCache;
bool fAbandoned;
sk_sp<const GrCaps> fCaps;
// In debug builds we guard against improper thread handling