Add renderTasks to the DAG before calling addDependency

This makes sure the dependent task is already in the DAG before a
textureResolveRenderTask calls "addBeforeLast".

Bug: skia:
Change-Id: Ib276d41c386fd3d5a237212d60d7bf67a662e419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237257
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrTextureResolveRenderTask.cpp b/src/gpu/GrTextureResolveRenderTask.cpp
index 1e52b87..0ae9356 100644
--- a/src/gpu/GrTextureResolveRenderTask.cpp
+++ b/src/gpu/GrTextureResolveRenderTask.cpp
@@ -13,30 +13,23 @@
 #include "src/gpu/GrResourceAllocator.h"
 #include "src/gpu/GrTexturePriv.h"
 
-sk_sp<GrRenderTask> GrTextureResolveRenderTask::Make(
-        sk_sp<GrTextureProxy> textureProxy, GrTextureResolveFlags flags, const GrCaps& caps) {
-    GrTextureProxy* textureProxyPtr = textureProxy.get();
-    sk_sp<GrTextureResolveRenderTask> resolveTask(
-            new GrTextureResolveRenderTask(std::move(textureProxy), flags));
-
+void GrTextureResolveRenderTask::init(const GrCaps& caps) {
     // Add the target as a dependency: We will read the existing contents of this texture while
     // generating mipmap levels and/or resolving MSAA.
     //
     // NOTE: This must be called before makeClosed.
-    resolveTask->addDependency(
-            textureProxyPtr, GrMipMapped::kNo, GrTextureResolveManager(nullptr), caps);
-    textureProxyPtr->setLastRenderTask(resolveTask.get());
+    this->addDependency(fTarget.get(), GrMipMapped::kNo, GrTextureResolveManager(nullptr), caps);
+    fTarget->setLastRenderTask(this);
 
     // We only resolve the texture; nobody should try to do anything else with this opsTask.
-    resolveTask->makeClosed(caps);
+    this->makeClosed(caps);
 
-    if (GrTextureResolveFlags::kMipMaps & flags) {
-        SkASSERT(GrMipMapped::kYes == textureProxyPtr->mipMapped());
-        SkASSERT(textureProxyPtr->mipMapsAreDirty());
-        textureProxyPtr->markMipMapsClean();
+    if (GrTextureResolveFlags::kMipMaps & fResolveFlags) {
+        GrTextureProxy* textureProxy = fTarget->asTextureProxy();
+        SkASSERT(GrMipMapped::kYes == textureProxy->mipMapped());
+        SkASSERT(textureProxy->mipMapsAreDirty());
+        textureProxy->markMipMapsClean();
     }
-
-    return resolveTask;
 }
 
 void GrTextureResolveRenderTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {