Mark mipmaps dirty from makeClosed() rather than opList constructors

Bug: skia:
Change-Id: Ia90877399777134e735ac6328fff629748ef49d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235158
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrRenderTask.h b/src/gpu/GrRenderTask.h
index 6b4edc8..044817a 100644
--- a/src/gpu/GrRenderTask.h
+++ b/src/gpu/GrRenderTask.h
@@ -28,16 +28,12 @@
     GrRenderTask(sk_sp<GrSurfaceProxy> target);
     ~GrRenderTask() override;
 
+    void makeClosed(const GrCaps&);
+
     // These two methods are only invoked at flush time
     void prepare(GrOpFlushState* flushState);
     bool execute(GrOpFlushState* flushState) { return this->onExecute(flushState); }
 
-    virtual void makeClosed(const GrCaps&) {
-        if (!this->isClosed()) {
-            this->setFlag(kClosed_Flag);
-        }
-    }
-
     // Called when this class will survive a flush and needs to truncate its ops and start over.
     // TODO: ultimately it should be invalid for an op list to survive a flush.
     // https://bugs.chromium.org/p/skia/issues/detail?id=7111
@@ -82,6 +78,13 @@
 
     SkDEBUGCODE(bool deferredProxiesAreInstantiated() const;)
 
+    enum class ExpectedOutcome : bool {
+        kTargetUnchanged,
+        kTargetDirty,
+    };
+
+    virtual ExpectedOutcome onMakeClosed(const GrCaps&) = 0;
+
     sk_sp<GrSurfaceProxy> fTarget;
 
     // List of texture proxies whose contents are being prepared on a worker thread