Revert "Add flush() to SkImage."

This reverts commit d0503a72ac4293562a8e88be33633ec0cf55c3d4.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Add flush() to SkImage.
> 
> This allows a client to ensure all uses of a texture-backed image have
> been flushed.
> 
> Does nothing if the image isn't texture-backed.
> 
> The implementation adds support for triggering a flush if any of a set
> of proxies are used rather than just a single proxy.
> 
> Change-Id: I358882d9737e63c6e69b924c0767f49b8f8f36ec
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212405
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: Ie376bf4225307f45b8fb3eb4a63bf84702365797
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212884
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 19d1f6e..a90dce9 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -264,7 +264,7 @@
         return GrSemaphoresSubmitted::kNo;
     }
 
-    return this->drawingManager()->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
+    return this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
                                          info);
 }
 
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 10772ef..dfb2c0b 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -24,12 +24,12 @@
 #include "src/image/SkImage_Base.h"
 #include "src/image/SkImage_Gpu.h"
 
-#define ASSERT_OWNED_PROXY(P) \
+#define ASSERT_OWNED_PROXY_PRIV(P) \
     SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == fContext)
-#define ASSERT_SINGLE_OWNER \
+#define ASSERT_SINGLE_OWNER_PRIV \
     SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fContext->singleOwner());)
-#define RETURN_VALUE_IF_ABANDONED(value) if (fContext->abandoned()) { return (value); }
-#define RETURN_IF_ABANDONED RETURN_VALUE_IF_ABANDONED(void)
+#define RETURN_IF_ABANDONED_PRIV if (fContext->abandoned()) { return; }
+#define RETURN_FALSE_IF_ABANDONED_PRIV if (fContext->abandoned()) { return false; }
 
 sk_sp<const GrCaps> GrContextPriv::refCaps() const {
     return fContext->refCaps();
@@ -103,7 +103,7 @@
 sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackendTexture& tex,
                                                                  GrSurfaceOrigin origin,
                                                                  sk_sp<SkColorSpace> colorSpace) {
-    ASSERT_SINGLE_OWNER
+    ASSERT_SINGLE_OWNER_PRIV
 
     sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendTexture(
             tex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
@@ -122,7 +122,7 @@
                                                                    const SkSurfaceProps* props,
                                                                    ReleaseProc releaseProc,
                                                                    ReleaseContext releaseCtx) {
-    ASSERT_SINGLE_OWNER
+    ASSERT_SINGLE_OWNER_PRIV
     SkASSERT(sampleCnt > 0);
 
     sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture(
@@ -143,7 +143,7 @@
                                                 const SkSurfaceProps* surfaceProps,
                                                 ReleaseProc releaseProc,
                                                 ReleaseContext releaseCtx) {
-    ASSERT_SINGLE_OWNER
+    ASSERT_SINGLE_OWNER_PRIV
 
     sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget(
             backendRT, origin, releaseProc, releaseCtx);
@@ -162,7 +162,7 @@
                                                      int sampleCnt,
                                                      sk_sp<SkColorSpace> colorSpace,
                                                      const SkSurfaceProps* props) {
-    ASSERT_SINGLE_OWNER
+    ASSERT_SINGLE_OWNER_PRIV
     SkASSERT(sampleCnt > 0);
     sk_sp<GrSurfaceProxy> proxy(
             this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt));
@@ -177,7 +177,7 @@
 
 sk_sp<GrRenderTargetContext> GrContextPriv::makeVulkanSecondaryCBRenderTargetContext(
         const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo, const SkSurfaceProps* props) {
-    ASSERT_SINGLE_OWNER
+    ASSERT_SINGLE_OWNER_PRIV
     sk_sp<GrSurfaceProxy> proxy(
             this->proxyProvider()->wrapVulkanSecondaryCBAsRenderTarget(imageInfo, vkInfo));
     if (!proxy) {
@@ -189,22 +189,23 @@
                                                            props);
 }
 
-GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
-                                                   const GrFlushInfo& info) {
-    ASSERT_SINGLE_OWNER
-    RETURN_VALUE_IF_ABANDONED(GrSemaphoresSubmitted::kNo)
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "flushSurfaces", fContext);
-    SkASSERT(numProxies >= 0);
-    SkASSERT(!numProxies || proxies);
-    for (int i = 0; i < numProxies; ++i) {
-        SkASSERT(proxies[i]);
-        ASSERT_OWNED_PROXY(proxies[i]);
-    }
-    return fContext->drawingManager()->flushSurfaces(
-            proxies, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
+void GrContextPriv::flush(GrSurfaceProxy* proxy) {
+    ASSERT_SINGLE_OWNER_PRIV
+    RETURN_IF_ABANDONED_PRIV
+    ASSERT_OWNED_PROXY_PRIV(proxy);
+
+    fContext->drawingManager()->flush(proxy, SkSurface::BackendSurfaceAccess::kNoAccess,
+                                      GrFlushInfo());
 }
 
-void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) { this->flushSurfaces(&proxy, 1, {}); }
+void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) {
+    ASSERT_SINGLE_OWNER_PRIV
+    RETURN_IF_ABANDONED_PRIV
+    SkASSERT(proxy);
+    ASSERT_OWNED_PROXY_PRIV(proxy);
+    fContext->drawingManager()->flushSurface(proxy,
+            SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
+}
 
 static bool valid_premul_color_type(GrColorType ct) {
     switch (ct) {
@@ -276,11 +277,11 @@
                                       int height, GrColorType dstColorType,
                                       SkColorSpace* dstColorSpace, void* buffer, size_t rowBytes,
                                       uint32_t pixelOpsFlags) {
-    ASSERT_SINGLE_OWNER
-    RETURN_VALUE_IF_ABANDONED(false)
+    ASSERT_SINGLE_OWNER_PRIV
+    RETURN_FALSE_IF_ABANDONED_PRIV
     SkASSERT(src);
     SkASSERT(buffer);
-    ASSERT_OWNED_PROXY(src->asSurfaceProxy());
+    ASSERT_OWNED_PROXY_PRIV(src->asSurfaceProxy());
     GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "readSurfacePixels", fContext);
 
     GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
@@ -430,7 +431,7 @@
         sk_bzero(buffer, tempPixmap.computeByteSize());
     }
 
-    this->flushSurface(srcProxy);
+    this->flush(srcProxy);
 
     if (!fContext->fGpu->readPixels(srcSurface, left, top, width, height, allowedColorType, buffer,
                                     rowBytes)) {
@@ -460,11 +461,11 @@
                                        int height, GrColorType srcColorType,
                                        SkColorSpace* srcColorSpace, const void* buffer,
                                        size_t rowBytes, uint32_t pixelOpsFlags) {
-    ASSERT_SINGLE_OWNER
-    RETURN_VALUE_IF_ABANDONED(false)
+    ASSERT_SINGLE_OWNER_PRIV
+    RETURN_FALSE_IF_ABANDONED_PRIV
     SkASSERT(dst);
     SkASSERT(buffer);
-    ASSERT_OWNED_PROXY(dst->asSurfaceProxy());
+    ASSERT_OWNED_PROXY_PRIV(dst->asSurfaceProxy());
     GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "writeSurfacePixels", fContext);
 
     if (GrColorType::kUnknown == srcColorType) {
@@ -631,7 +632,7 @@
     // giving the drawing manager the chance of skipping the flush (i.e., by passing in the
     // destination proxy)
     // TODO: should this policy decision just be moved into the drawing manager?
-    this->flushSurface(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
+    this->flush(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
 
     return this->getGpu()->writePixels(dstSurface, left, top, width, height, srcColorType, buffer,
                                        rowBytes);
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 9e8e729..ebf3f6a 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -164,18 +164,22 @@
             const SkImageInfo&, const GrVkDrawableInfo&, const SkSurfaceProps* = nullptr);
 
     /**
-     * Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves
-     * if necessary. The GrSurfaceProxy array is treated as a hint. If it is supplied the context
-     * will guarantee that the draws required for those proxies are flushed but it could do more.
-     * If no array is provided then all current work will be flushed.
+     * Call to ensure all drawing to the context has been issued to the
+     * underlying 3D API.
+     * The 'proxy' parameter is a hint. If it is supplied the context will guarantee that
+     * the draws required for that proxy are flushed but it could do more. If no 'proxy' is
+     * provided then all current work will be flushed.
+     */
+    void flush(GrSurfaceProxy*);
+
+    /**
+     * Finalizes all pending reads and writes to the surface and also performs an MSAA resolve
+     * if necessary.
      *
      * It is not necessary to call this before reading the render target via Skia/GrContext.
      * GrContext will detect when it must perform a resolve before reading pixels back from the
      * surface or using it as a texture.
      */
-    GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy*[], int numProxies, const GrFlushInfo&);
-
-    /** Version of above that flushes for a single proxy and uses a default GrFlushInfo. */
     void flushSurface(GrSurfaceProxy*);
 
    /**
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index c56101e..4d00261 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -194,12 +194,9 @@
 }
 
 // MDB TODO: make use of the 'proxy' parameter.
-GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxies[],
-                                              int numProxies,
+GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxy,
                                               SkSurface::BackendSurfaceAccess access,
                                               const GrFlushInfo& info) {
-    SkASSERT(numProxies >= 0);
-    SkASSERT(!numProxies || proxies);
     GR_CREATE_TRACE_MARKER_CONTEXT("GrDrawingManager", "flush", fContext);
 
     if (fFlushing || this->wasAbandoned()) {
@@ -211,14 +208,9 @@
 
     SkDEBUGCODE(this->validate());
 
-    if (kNone_GrFlushFlags == info.fFlags && !info.fNumSemaphores && !info.fFinishedProc) {
-        bool canSkip = numProxies > 0;
-        for (int i = 0; i < numProxies && canSkip; ++i) {
-            canSkip = !fDAG.isUsed(proxies[i]) && !this->isDDLTarget(proxies[i]);
-        }
-        if (canSkip) {
-            return GrSemaphoresSubmitted::kNo;
-        }
+    if (kNone_GrFlushFlags == info.fFlags && !info.fNumSemaphores && !info.fFinishedProc &&
+            proxy && !this->isDDLTarget(proxy) && !fDAG.isUsed(proxy)) {
+        return GrSemaphoresSubmitted::kNo;
     }
 
     auto direct = fContext->priv().asDirectContext();
@@ -357,7 +349,7 @@
     opMemoryPool->isEmpty();
 #endif
 
-    GrSemaphoresSubmitted result = gpu->finishFlush(proxies, numProxies, access, info);
+    GrSemaphoresSubmitted result = gpu->finishFlush(proxy, access, info);
 
     flushState.deinstantiateProxyTracker()->deinstantiateAllProxies();
 
@@ -440,7 +432,7 @@
         onFlushOpList = nullptr;
         (*numOpListsExecuted)++;
         if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
-            flushState->gpu()->finishFlush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
+            flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
                                            GrFlushInfo());
             *numOpListsExecuted = 0;
         }
@@ -458,7 +450,7 @@
         }
         (*numOpListsExecuted)++;
         if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
-            flushState->gpu()->finishFlush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
+            flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
                                            GrFlushInfo());
             *numOpListsExecuted = 0;
         }
@@ -477,15 +469,13 @@
     return anyOpListsExecuted;
 }
 
-GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[], int n,
-                                                      SkSurface::BackendSurfaceAccess access,
-                                                      const GrFlushInfo& info) {
+GrSemaphoresSubmitted GrDrawingManager::flushSurface(
+        GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access, const GrFlushInfo& info) {
     if (this->wasAbandoned()) {
         return GrSemaphoresSubmitted::kNo;
     }
     SkDEBUGCODE(this->validate());
-    SkASSERT(proxies);
-    SkASSERT(n > 0);
+    SkASSERT(proxy);
 
     auto direct = fContext->priv().asDirectContext();
     if (!direct) {
@@ -498,25 +488,21 @@
     }
 
     // TODO: It is important to upgrade the drawingmanager to just flushing the
-    // portion of the DAG required by 'proxies' in order to restore some of the
+    // portion of the DAG required by 'proxy' in order to restore some of the
     // semantics of this method.
-    GrSemaphoresSubmitted result = this->flush(proxies, n, access, info);
-    for (int i = 0; i < n; ++i) {
-        if (!proxies[i]->isInstantiated()) {
-            return result;
-        }
+    GrSemaphoresSubmitted result = this->flush(proxy, access, info);
+    if (!proxy->isInstantiated()) {
+        return result;
     }
 
-    for (int i = 0; i < n; ++i) {
-        GrSurface* surface = proxies[i]->peekSurface();
-        if (auto* rt = surface->asRenderTarget()) {
-            gpu->resolveRenderTarget(rt);
-        }
-        if (auto* tex = surface->asTexture()) {
-            if (tex->texturePriv().mipMapped() == GrMipMapped::kYes &&
-                tex->texturePriv().mipMapsAreDirty()) {
-                gpu->regenerateMipMapLevels(tex);
-            }
+    GrSurface* surface = proxy->peekSurface();
+    if (auto* rt = surface->asRenderTarget()) {
+        gpu->resolveRenderTarget(rt);
+    }
+    if (auto* tex = surface->asTexture()) {
+        if (tex->texturePriv().mipMapped() == GrMipMapped::kYes &&
+            tex->texturePriv().mipMapsAreDirty()) {
+            gpu->regenerateMipMapLevels(tex);
         }
     }
 
@@ -745,7 +731,7 @@
 
     auto resourceCache = direct->priv().getResourceCache();
     if (resourceCache && resourceCache->requestsFlush()) {
-        this->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
+        this->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
         resourceCache->purgeAsNeeded();
     }
 }
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 521ed66..2b04b9a 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -71,15 +71,9 @@
 
     static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);
 
-    GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[],
-                                        int cnt,
-                                        SkSurface::BackendSurfaceAccess access,
-                                        const GrFlushInfo& info);
-    GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy,
+    GrSemaphoresSubmitted flushSurface(GrSurfaceProxy*,
                                        SkSurface::BackendSurfaceAccess access,
-                                       const GrFlushInfo& info) {
-        return this->flushSurfaces(&proxy, 1, access, info);
-    }
+                                       const GrFlushInfo& info);
 
     void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
 
@@ -153,8 +147,7 @@
     // return true if any opLists were actually executed; false otherwise
     bool executeOpLists(int startIndex, int stopIndex, GrOpFlushState*, int* numOpListsExecuted);
 
-    GrSemaphoresSubmitted flush(GrSurfaceProxy* proxies[],
-                                int numProxies,
+    GrSemaphoresSubmitted flush(GrSurfaceProxy* proxy,
                                 SkSurface::BackendSurfaceAccess access,
                                 const GrFlushInfo&);
 
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 479d733..c57b169 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -412,8 +412,7 @@
     return fSamplePatternDictionary.findOrAssignSamplePatternKey(sampleLocations);
 }
 
-GrSemaphoresSubmitted GrGpu::finishFlush(GrSurfaceProxy* proxies[],
-                                         int n,
+GrSemaphoresSubmitted GrGpu::finishFlush(GrSurfaceProxy* proxy,
                                          SkSurface::BackendSurfaceAccess access,
                                          const GrFlushInfo& info) {
     this->stats()->incNumFinishFlushes();
@@ -437,7 +436,7 @@
             }
         }
     }
-    this->onFinishFlush(proxies, n, access, info);
+    this->onFinishFlush(proxy, access, info);
     return this->caps()->semaphoreSupport() ? GrSemaphoresSubmitted::kYes
                                             : GrSemaphoresSubmitted::kNo;
 }
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index be4a9bf..5b90f05 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -303,8 +303,8 @@
     // Provides a hook for post-flush actions (e.g. Vulkan command buffer submits). This will also
     // insert any numSemaphore semaphores on the gpu and set the backendSemaphores to match the
     // inserted semaphores.
-    GrSemaphoresSubmitted finishFlush(GrSurfaceProxy*[], int n,
-                                      SkSurface::BackendSurfaceAccess access, const GrFlushInfo&);
+    GrSemaphoresSubmitted finishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
+                                      const GrFlushInfo&);
 
     virtual void submit(GrGpuCommandBuffer*) = 0;
 
@@ -547,7 +547,7 @@
                                const SkIRect& srcRect, const SkIPoint& dstPoint,
                                bool canDiscardOutsideDstRect) = 0;
 
-    virtual void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
+    virtual void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                                const GrFlushInfo&) = 0;
 
 #ifdef SK_ENABLE_DUMP_GPU
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index f41733c..197a1a6 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4274,7 +4274,7 @@
     return attribState;
 }
 
-void GrGLGpu::onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
+void GrGLGpu::onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                             const GrFlushInfo& info) {
     // If we inserted semaphores during the flush, we need to call GLFlush.
     bool insertedSemaphore = info.fNumSemaphores > 0 && this->caps()->semaphoreSupport();
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index fde6d22..b2821e4 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -295,7 +295,7 @@
 
     void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle&);
 
-    void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
+    void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                        const GrFlushInfo&) override;
 
     bool waitSync(GrGLsync, uint64_t timeout, bool flush);
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index 5df9c02..57d8f7a 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -111,7 +111,7 @@
 
     void onResolveRenderTarget(GrRenderTarget* target) override { return; }
 
-    void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
+    void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                        const GrFlushInfo& info) override {
         if (info.fFinishedProc) {
             info.fFinishedProc(info.fFinishedContext);
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 0eed4ed..d16ae2d 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -184,7 +184,7 @@
 
     void onResolveRenderTarget(GrRenderTarget* target) override { return; }
 
-    void onFinishFlush(GrSurfaceProxy*[], int n, SkSurface::BackendSurfaceAccess access,
+    void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                        const GrFlushInfo& info) override {
         if (info.fFlags & kSyncCpu_GrFlushFlag) {
             this->submitCommandBuffer(kForce_SyncQueue);
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index b1c9979..a82775a 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1889,25 +1889,21 @@
                                        barrier);
 }
 
-void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxies[], int n,
-                            SkSurface::BackendSurfaceAccess access, const GrFlushInfo& info) {
-    SkASSERT(n >= 0);
-    SkASSERT(!n || proxies);
+void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access,
+                            const GrFlushInfo& info) {
     // Submit the current command buffer to the Queue. Whether we inserted semaphores or not does
     // not effect what we do here.
-    if (n && access == SkSurface::BackendSurfaceAccess::kPresent) {
+    if (proxy && access == SkSurface::BackendSurfaceAccess::kPresent) {
         GrVkImage* image;
-        for (int i = 0; i < n; ++i) {
-            SkASSERT(proxies[i]->isInstantiated());
-            if (GrTexture* tex = proxies[i]->peekTexture()) {
-                image = static_cast<GrVkTexture*>(tex);
-            } else {
-                GrRenderTarget* rt = proxies[i]->peekRenderTarget();
-                SkASSERT(rt);
-                image = static_cast<GrVkRenderTarget*>(rt);
-            }
-            image->prepareForPresent(this);
+        SkASSERT(proxy->isInstantiated());
+        if (GrTexture* tex = proxy->peekTexture()) {
+            image = static_cast<GrVkTexture*>(tex);
+        } else {
+            GrRenderTarget* rt = proxy->peekRenderTarget();
+            SkASSERT(rt);
+            image = static_cast<GrVkRenderTarget*>(rt);
         }
+        image->prepareForPresent(this);
     }
     if (info.fFlags & kSyncCpu_GrFlushFlag) {
         this->submitCommandBuffer(kForce_SyncQueue, info.fFinishedProc, info.fFinishedContext);
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 9446467..2321f9a 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -225,7 +225,7 @@
                        GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
                        const SkIPoint& dstPoint, bool canDiscardOutsideDstRect) override;
 
-    void onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
+    void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
                        const GrFlushInfo&) override;
 
     // Ends and submits the current command buffer to the queue and then creates a new command
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 8c27a1d..cbc8a01 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -160,12 +160,6 @@
     return as_IB(this)->onIsValid(context);
 }
 
-GrSemaphoresSubmitted SkImage::flush(GrContext* context, const GrFlushInfo& flushInfo) {
-    return as_IB(this)->onFlush(context, flushInfo);
-}
-
-void SkImage::flush(GrContext* context) { as_IB(this)->onFlush(context, {}); }
-
 #else
 
 GrTexture* SkImage::getTexture() const { return nullptr; }
@@ -184,12 +178,6 @@
     return as_IB(this)->onIsValid(context);
 }
 
-GrSemaphoresSubmitted SkImage::flush(GrContext*, const GrFlushInfo&) {
-    return GrSemaphoresSubmitted::kNo;
-}
-
-void SkImage::flush(GrContext*) {}
-
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index b06d7fc..3b28dd6 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -48,10 +48,6 @@
     virtual GrContext* context() const { return nullptr; }
 
 #if SK_SUPPORT_GPU
-    virtual GrSemaphoresSubmitted onFlush(GrContext* context, const GrFlushInfo&) {
-        return GrSemaphoresSubmitted::kNo;
-    }
-
     // Return the proxy if this image is backed by a single proxy. For YUVA images, this
     // will return nullptr unless the YUVA planes have been converted to RGBA in which case
     // that single backing proxy will be returned.
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 02bb8b5..5f77ceb 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -64,15 +64,6 @@
 
 SkImage_Gpu::~SkImage_Gpu() {}
 
-GrSemaphoresSubmitted SkImage_Gpu::onFlush(GrContext* context, const GrFlushInfo& info) {
-    if (!context || !fContext->priv().matches(context) || fContext->abandoned()) {
-        return GrSemaphoresSubmitted::kNo;
-    }
-
-    GrSurfaceProxy* p[1] = {fProxy.get()};
-    return context->priv().flushSurfaces(p, 1, info);
-}
-
 sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* context,
                                                          SkColorType targetCT,
                                                          sk_sp<SkColorSpace> targetCS) const {
@@ -665,8 +656,7 @@
 
     GrFlushInfo info;
     info.fFlags = kSyncCpu_GrFlushFlag;
-    GrSurfaceProxy* p[1] = {proxy.get()};
-    drawingManager->flush(p, 1, SkSurface::BackendSurfaceAccess::kNoAccess, info);
+    drawingManager->flush(proxy.get(), SkSurface::BackendSurfaceAccess::kNoAccess, info);
 
     return image;
 }
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 08cd131..8ee0e0f 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -26,8 +26,6 @@
                 sk_sp<SkColorSpace>);
     ~SkImage_Gpu() override;
 
-    GrSemaphoresSubmitted onFlush(GrContext*, const GrFlushInfo&) override;
-
     GrTextureProxy* peekProxy() const override {
         return fProxy.get();
     }
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 915d0de..7f5a7ec 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -103,21 +103,6 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
-GrSemaphoresSubmitted SkImage_GpuYUVA::onFlush(GrContext* context, const GrFlushInfo& info) {
-    if (!context || !fContext->priv().matches(context) || fContext->abandoned()) {
-        return GrSemaphoresSubmitted::kNo;
-    }
-
-    GrSurfaceProxy* proxies[5] = {fProxies[0].get(), fProxies[1].get(),
-                                  fProxies[2].get(), fProxies[3].get(), nullptr};
-    int numProxies = fNumProxies;
-    if (fRGBProxy) {
-        proxies[fNumProxies] = fRGBProxy.get();
-        ++numProxies;
-    }
-    return context->priv().flushSurfaces(proxies, numProxies, info);
-}
-
 GrTextureProxy* SkImage_GpuYUVA::peekProxy() const {
     return fRGBProxy.get();
 }
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index daa9ee1..eee5759 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -29,8 +29,6 @@
                     GrSurfaceOrigin, sk_sp<SkColorSpace>);
     ~SkImage_GpuYUVA() override;
 
-    GrSemaphoresSubmitted onFlush(GrContext*, const GrFlushInfo&) override;
-
     // This returns the single backing proxy if the YUV channels have already been flattened but
     // nullptr if they have not.
     GrTextureProxy* peekProxy() const override;
@@ -58,8 +56,6 @@
     // Returns a ref-ed texture proxy with miplevels
     sk_sp<GrTextureProxy> asMippedTextureProxyRef(GrRecordingContext*) const;
 
-    bool testingOnly_IsFlattened() const { return SkToBool(fRGBProxy); }
-
     /**
      * This is the implementation of SkDeferredDisplayListRecorder::makeYUVAPromiseTexture.
      */