Plumb abandonment throughout GrContext hierarchy
When the GrImageContext & GrRecordingContext are actually GrDirectContexts it is useful for them to report the abandonment state of the GrDirectContext.
When the GrImageContext & GrRecordingContext are actually GrImageCreationContext or GrDDLContexts then they will just never be abandoned.
This CL also strips the GrProxyProvider and GrDrawingManager of their tracking on abandonment and centralizes it in the GrImageContext.
ImageContext
can't abandon
can only check abandonment privately
RecordingContext
can't abandon
can only check abandonment privately
DirectContext (aka GrContext)
can abandon publicly
can check abandonment publicly
Note that abandoning the DirectContext won't alter the abandonment status of any of
the other contexts in its group (e.g., DDL contexts that may be being used to record).
Change-Id: Ib790f74d90ab18da58a127fed2aad20e2477bd21
Reviewed-on: https://skia-review.googlesource.com/c/190669
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index dc467e3..151ef28 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -87,7 +87,7 @@
sk_sp<GrRenderTargetContext> renderTargetContext,
int width, int height,
InitContents init) {
- if (!renderTargetContext || renderTargetContext->wasAbandoned()) {
+ if (!renderTargetContext || context->abandoned()) {
return nullptr;
}
unsigned flags;
@@ -268,7 +268,7 @@
SkASSERT(newRTC->asSurfaceProxy()->priv().isExact());
if (shouldRetainContent) {
- if (fRenderTargetContext->wasAbandoned()) {
+ if (this->context()->abandoned()) {
return;
}
newRTC->copy(fRenderTargetContext->asSurfaceProxy());