Remove unused GrFlushFlags.

This also adds back default flush() calls which simply do a flush
without any submit.

Change-Id: Ia8c92bbdecd515d871abfa6364592f502e98656b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298818
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index ed499fc..0f6433b 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -6,8 +6,12 @@
 
 Milestone 86
 ------------
+
+  * Remove obsolete GrFlushFlags.
+    https://review.skia.org/298818
+
   * Adds default flush() calls to SkSurface, SkImage, and GrContext. These calls do
-    a basic flush without a submit. If you haven't updated Skia in a couple release
+    a basic flush without a submit. If you haven't updated Skia in a couple releases
     and still have flush() calls in your code that you expect to do a flush and
     submit, you should update all those to the previously added flushAndSubmit() calls
     instead.
diff --git a/bench/CreateBackendTextureBench.cpp b/bench/CreateBackendTextureBench.cpp
index 9d3c451..6873d04 100644
--- a/bench/CreateBackendTextureBench.cpp
+++ b/bench/CreateBackendTextureBench.cpp
@@ -41,9 +41,7 @@
     void onPerCanvasPostDraw(SkCanvas* canvas) override {
         GrContext* context = canvas->getGrContext();
 
-        GrFlushInfo info;
-        info.fFlags = kSyncCpu_GrFlushFlag;
-        context->flush(info);
+        context->flush();
         context->submit(true);
 
         for (int i = 0; i < fBackendTextures.count(); ++i) {
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 970c7f1..d78b0dc 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1863,9 +1863,7 @@
                                            // TODO: switch over to using the promiseImage callbacks
                                            // to free the backendTextures. This is complicated a
                                            // bit by which thread possesses the direct context.
-                                           GrFlushInfo flushInfoSyncCpu;
-                                           flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-                                           gpuThreadCtx->flush(flushInfoSyncCpu);
+                                           gpuThreadCtx->flush();
                                            gpuThreadCtx->submit(true);
                                        });
 
@@ -2334,9 +2332,7 @@
 
             // We need to ensure all the GPU work is finished so the promise image callback
             // contexts will delete all the backend textures.
-            GrFlushInfo flushInfoSyncCpu;
-            flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-            context->flush(flushInfoSyncCpu);
+            context->flush();
             context->submit(true);
         }
         return Result::Ok();
diff --git a/gm/asyncrescaleandread.cpp b/gm/asyncrescaleandread.cpp
index bd55929..3ad5b8f 100644
--- a/gm/asyncrescaleandread.cpp
+++ b/gm/asyncrescaleandread.cpp
@@ -112,9 +112,7 @@
     };
 
     *cleanup = {[context, backendTextures] {
-        GrFlushInfo flushInfo;
-        flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-        context->flush(flushInfo);
+        context->flush();
         context->submit(true);
         context->deleteBackendTexture(backendTextures[0]);
         context->deleteBackendTexture(backendTextures[1]);
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 1f3b3be..1cb589a 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -238,9 +238,7 @@
         // Some backends (e.g., Vulkan) require all work be completed for backend textures
         // before they are deleted. Since we don't know when we'll next have access to a
         // direct context, flush all the work now.
-        GrFlushInfo flushInfoSyncCpu;
-        flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-        context->flush(flushInfoSyncCpu);
+        context->flush();
         context->submit(true);
 
         return DrawResult::kOk;
diff --git a/gm/wacky_yuv_formats.cpp b/gm/wacky_yuv_formats.cpp
index 1712421..04fbce8 100644
--- a/gm/wacky_yuv_formats.cpp
+++ b/gm/wacky_yuv_formats.cpp
@@ -1365,9 +1365,7 @@
             // Some backends (e.g., Vulkan) require all work be completed for backend textures
             // before they are deleted. Since we don't know when we'll next have access to a
             // direct context, flush all the work now.
-            GrFlushInfo flushInfoSyncCpu;
-            flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-            context->flush(flushInfoSyncCpu);
+            context->flush();
             context->submit(true);
         }
 
@@ -1594,9 +1592,7 @@
         // Some backends (e.g., Vulkan) require all work be completed for backend textures before
         // they are deleted. Since we don't know when we'll next have access to a direct context,
         // flush all the work now.
-        GrFlushInfo flushInfoSyncCpu;
-        flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-        context->flush(flushInfoSyncCpu);
+        context->flush();
         context->submit(true);
 
         return true;
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index b6f5e6f..50de318 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -225,12 +225,6 @@
  */
 static const uint32_t kAll_GrBackendState = 0xffffffff;
 
-enum GrFlushFlags {
-    kNone_GrFlushFlags = 0,
-    // Deprecated: Use syncCpu call on submit instead.
-    kSyncCpu_GrFlushFlag = 0x1,
-};
-
 typedef void* GrGpuFinishedContext;
 typedef void (*GrGpuFinishedProc)(GrGpuFinishedContext finishedContext);
 
@@ -273,7 +267,6 @@
  * backend APIs the same in terms of how the submitted procs are treated.
  */
 struct GrFlushInfo {
-    GrFlushFlags fFlags = kNone_GrFlushFlags;
     int fNumSemaphores = 0;
     GrBackendSemaphore* fSignalSemaphores = nullptr;
     GrGpuFinishedProc fFinishedProc = nullptr;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index f61fedf..cffc136 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -200,8 +200,8 @@
 
     SkDEBUGCODE(this->validate());
 
-    if (kNone_GrFlushFlags == info.fFlags && !info.fNumSemaphores && !info.fFinishedProc &&
-            access == SkSurface::BackendSurfaceAccess::kNoAccess && !newState) {
+    if (!info.fNumSemaphores && !info.fFinishedProc &&
+        access == SkSurface::BackendSurfaceAccess::kNoAccess && !newState) {
         bool canSkip = numProxies > 0;
         for (int i = 0; i < numProxies && canSkip; ++i) {
             canSkip = !fDAG.isUsed(proxies[i]) && !this->isDDLTarget(proxies[i]);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 2fac0b1..69b18ac 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -753,10 +753,8 @@
                                             std::move(cs));
     surfaceContext.writePixels(srcInfo, pixmap.addr(0, 0), pixmap.rowBytes(), {0, 0});
 
-    GrFlushInfo info;
-    info.fFlags = kSyncCpu_GrFlushFlag;
     GrSurfaceProxy* p[1] = {surfaceContext.asSurfaceProxy()};
-    drawingManager->flush(p, 1, SkSurface::BackendSurfaceAccess::kNoAccess, info, nullptr);
+    drawingManager->flush(p, 1, SkSurface::BackendSurfaceAccess::kNoAccess, {}, nullptr);
 
     return image;
 }
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index 7573cbc..fd6ad72 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -1089,9 +1089,7 @@
         GrBackendApi::kMetal  == context->backend()) {
         // In order to receive the done callback with Vulkan we need to perform the equivalent
         // of a glFinish
-        GrFlushInfo flushInfoSyncCpu;
-        flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-        s->flush(SkSurface::BackendSurfaceAccess::kPresent, flushInfoSyncCpu);
+        s->flush();
         context->submit(true);
     }
 
diff --git a/tests/GLBackendSurfaceTest.cpp b/tests/GLBackendSurfaceTest.cpp
index b5a6ab9..7773137 100644
--- a/tests/GLBackendSurfaceTest.cpp
+++ b/tests/GLBackendSurfaceTest.cpp
@@ -126,9 +126,7 @@
     REPORTER_ASSERT(reporter, GrBackendTexture::TestingOnly_Equals(invalidTexture, invalidTexture));
 
     wrappedImage.reset();
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    context->flush(flushInfo);
+    context->flush();
     context->submit(true);
     context->deleteBackendTexture(backendTex);
 }
diff --git a/tests/GrFinishedFlushTest.cpp b/tests/GrFinishedFlushTest.cpp
index c6e211c..8f71eee 100644
--- a/tests/GrFinishedFlushTest.cpp
+++ b/tests/GrFinishedFlushTest.cpp
@@ -47,9 +47,7 @@
     canvas->clear(SK_ColorGREEN);
     auto image = surface->makeImageSnapshot();
 
-    GrFlushInfo flushInfoSyncCpu;
-    flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-    ctx->flush(flushInfoSyncCpu);
+    ctx->flush();
     ctx->submit(true);
 
     int count = 0;
@@ -58,7 +56,7 @@
     flushInfoFinishedProc.fFinishedProc = testing_finished_proc;
     flushInfoFinishedProc.fFinishedContext = (void*)&count;
     // There is no work on the surface so flushing may immediately call the finished proc.
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
+    surface->flush(flushInfoFinishedProc);
     ctx->submit();
     REPORTER_ASSERT(reporter, count == 0 || count == 1);
     // Busy waiting should detect that the work is done.
@@ -66,7 +64,7 @@
 
     canvas->clear(SK_ColorRED);
 
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
+    surface->flush(flushInfoFinishedProc);
     ctx->submit();
 
     bool expectAsyncCallback =
@@ -82,7 +80,7 @@
     } else {
         REPORTER_ASSERT(reporter, count == 2);
     }
-    ctx->flush(flushInfoSyncCpu);
+    ctx->flush();
     ctx->submit(true);
     REPORTER_ASSERT(reporter, count == 2);
 
@@ -97,7 +95,7 @@
     } else {
         REPORTER_ASSERT(reporter, count == 3);
     }
-    ctx->flush(flushInfoSyncCpu);
+    ctx->flush();
     ctx->submit(true);
     REPORTER_ASSERT(reporter, count == 3);
 
@@ -112,7 +110,7 @@
     } else {
         REPORTER_ASSERT(reporter, count == 4);
     }
-    ctx->flush(flushInfoSyncCpu);
+    ctx->flush();
     ctx->submit(true);
     REPORTER_ASSERT(reporter, count == 4);
 
@@ -125,7 +123,7 @@
     count = 0;
     int count2 = 0;
     canvas->clear(SK_ColorGREEN);
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
+    surface->flush(flushInfoFinishedProc);
     ctx->submit();
     // There is no work to be flushed here so this will return immediately, but make sure the
     // finished call from this proc isn't called till the previous surface flush also is finished.
@@ -134,7 +132,7 @@
     ctx->submit();
     REPORTER_ASSERT(reporter, count <= 1 && count2 <= count);
 
-    ctx->flush(flushInfoSyncCpu);
+    ctx->flush();
     ctx->submit(true);
 
     REPORTER_ASSERT(reporter, count == 1);
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 3b67073..95b8185 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -1393,15 +1393,13 @@
     REPORTER_ASSERT(reporter, numSubmits() == 3);
 
     // Syncing forces the flush to happen even if the images aren't used.
-    GrFlushInfo syncInfo;
-    syncInfo.fFlags = kSyncCpu_GrFlushFlag;
-    i0->flush(c, syncInfo);
+    i0->flush(c);
     c->submit(true);
     REPORTER_ASSERT(reporter, numSubmits() == 1);
-    i1->flush(c, syncInfo);
+    i1->flush(c);
     c->submit(true);
     REPORTER_ASSERT(reporter, numSubmits() == 1);
-    i2->flush(c, syncInfo);
+    i2->flush(c);
     c->submit(true);
     REPORTER_ASSERT(reporter, numSubmits() == 1);
 
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 7c3924d..6ec303e 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -975,9 +975,7 @@
         }
 
         surface->getCanvas()->clear(SK_ColorRED);
-        GrFlushInfo info;
-        info.fFlags = kSyncCpu_GrFlushFlag;
-        surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, info);
+        surface->flush();
         ctx->submit(true);
 
         // Now exercise the release proc
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index 3c68cc0..6db730b 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -142,9 +142,7 @@
 }
 
 void DeleteBackendTexture(GrContext* context, const GrBackendTexture& backendTex) {
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    context->flush(flushInfo);
+    context->flush();
     context->submit(true);
     context->deleteBackendTexture(backendTex);
 }
diff --git a/tests/VkHardwareBufferTest.cpp b/tests/VkHardwareBufferTest.cpp
index 1aec3cc..c1248bd 100644
--- a/tests/VkHardwareBufferTest.cpp
+++ b/tests/VkHardwareBufferTest.cpp
@@ -357,9 +357,7 @@
 }
 
 void EGLTestHelper::doClientSync() {
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    this->grContext()->flush(flushInfo);
+    this->grContext()->flush();
     this->grContext()->submit(true);
 }
 #endif  // SK_GL
diff --git a/tests/VkProtectedContextTest.cpp b/tests/VkProtectedContextTest.cpp
index ae89c8f..db30f8b 100644
--- a/tests/VkProtectedContextTest.cpp
+++ b/tests/VkProtectedContextTest.cpp
@@ -179,9 +179,7 @@
     paint.setColor(SK_ColorBLACK);
     canvas->drawRect(SkRect::MakeWH(4, 4), paint);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -203,9 +201,7 @@
     paint.setAntiAlias(true);
     canvas->drawRect(SkRect::MakeWH(4, 4), paint);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -227,9 +223,7 @@
     paint.setBlendMode(SkBlendMode::kColorDodge);
     canvas->drawRect(SkRect::MakeWH(4, 4), paint);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -253,9 +247,7 @@
           SkBlurStyle::kOuter_SkBlurStyle, 1.1f));
     canvas->drawRect(SkRect::MakeWH(4, 4), paint);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -279,9 +271,7 @@
     paint.setStrokeWidth(.4f);
     canvas->drawPath(SkPath().moveTo(4, 4).lineTo(6, 6), paint);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -304,9 +294,7 @@
     canvas->drawRect(SkRect::MakeWH(4, 4), paint);
     canvas->restore();
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     surface->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
@@ -334,13 +322,11 @@
 
     canvas->drawImage(image, 0, 0);
 
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface1->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface1->flush();
     surface1->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface1->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
-    surface2->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface2->flush();
     surface2->getContext()->submit(true);
     protectedTestHelper->grContext()->deleteBackendTexture(
         surface2->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess));
diff --git a/tools/gpu/YUVUtils.cpp b/tools/gpu/YUVUtils.cpp
index b8dcc85..70021ee 100644
--- a/tools/gpu/YUVUtils.cpp
+++ b/tools/gpu/YUVUtils.cpp
@@ -91,13 +91,10 @@
 
     // Some backends (e.g., Vulkan) require that all work associated w/ texture
     // creation be completed before deleting the textures.
-
     if (fullFlush) {
         // If the release context client performed some operations other than backend texture
         // creation then we may require a full flush to ensure that all the work is completed.
-        GrFlushInfo flushInfoSyncCpu;
-        flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
-        context->flush(flushInfoSyncCpu);
+        context->flush();
         context->submit(true);
     } else {
         context->submit();
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index e0c0fcb..519a240 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -324,9 +324,7 @@
 
     // Make sure the gpu has finished all its work before we exit this function and delete the
     // fence.
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    context->flush(flushInfo);
+    context->flush();
     context->submit(true);
 
     promiseImageHelper.deleteAllFromGPU(nullptr, context);
@@ -364,9 +362,7 @@
 
     // Make sure the gpu has finished all its work before we exit this function and delete the
     // fence.
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     context->submit(true);
 }
 
@@ -434,9 +430,7 @@
 
     // Make sure the gpu has finished all its work before we exit this function and delete the
     // fence.
-    GrFlushInfo flushInfo;
-    flushInfo.fFlags = kSyncCpu_GrFlushFlag;
-    surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfo);
+    surface->flush();
     context->submit(true);
 }