Split apart flushing and submitting in the GrGpu classes and GrDrawingManager.

Bug: skia:10118
Change-Id: I53e3b9f1bd28a00276a3d35b5160aa0cfec30cfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282417
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index ebebd19..fce2526 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -319,8 +319,17 @@
         return GrSemaphoresSubmitted::kNo;
     }
 
-    return this->drawingManager()->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
-                                         info, externalRequests);
+    bool submitted = false;
+    if (this->drawingManager()->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
+                                      info, externalRequests)) {
+        bool forceSync = SkToBool(info.fFlags & kSyncCpu_GrFlushFlag);
+        submitted = this->drawingManager()->submitToGpu(forceSync);
+    }
+
+    if (!submitted || (!this->priv().caps()->semaphoreSupport() && info.fNumSemaphores)) {
+        return GrSemaphoresSubmitted::kNo;
+    }
+    return GrSemaphoresSubmitted::kYes;
 }
 
 ////////////////////////////////////////////////////////////////////////////////