Make remaining GrOp derived classes be skgpu::v1 only

I will follow up with a CL actually moving the newly V1-only files to their final homes and adding namespaces.

Bug: skia:11837
Change-Id: I0fed1a802ae93a4357c53cde2b665ad6ddb49a6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418996
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index bf034f7..9298588 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -43,8 +43,8 @@
 #include "src/gpu/text/GrSDFTControl.h"
 #include "src/image/SkSurface_Gpu.h"
 
-#include "src/gpu/GrOpsTask.h"
 #if SK_GPU_V1
+#include "src/gpu/GrOpsTask.h"
 #include "src/gpu/GrSoftwarePathRenderer.h"
 #endif
 
@@ -370,7 +370,7 @@
         return;
     }
 
-#ifdef SK_DEBUG
+#if SK_GPU_V1 && defined(SK_DEBUG)
     // This block checks for any unnecessary splits in the opsTasks. If two sequential opsTasks
     // could have merged it means the opsTask was artificially split.
     if (!fDAG.empty()) {
@@ -427,6 +427,7 @@
     int newCount = 0;
     for (int i = 0; i < fDAG.count(); i++) {
         sk_sp<GrRenderTask>& task = fDAG[i];
+#if SK_GPU_V1
         if (auto opsTask = task->asOpsTask()) {
             size_t remaining = fDAG.size() - i - 1;
             SkSpan<sk_sp<GrRenderTask>> nextTasks{fDAG.end() - remaining, remaining};
@@ -436,6 +437,7 @@
             }
             i += removeCount;
         }
+#endif
         fDAG[newCount++] = std::move(task);
     }
     fDAG.resize_back(newCount);
@@ -608,6 +610,7 @@
                                      SkIPoint offset) {
     SkDEBUGCODE(this->validate());
 
+#if SK_GPU_V1
     if (fActiveOpsTask) {
         // This is a temporary fix for the partial-MDB world. In that world we're not
         // reordering so ops that (in the single opsTask world) would've just glommed onto the
@@ -616,6 +619,7 @@
         fActiveOpsTask->makeClosed(fContext);
         fActiveOpsTask = nullptr;
     }
+#endif
 
     // Propagate the DDL proxy's state information to the replay target.
     if (ddl->priv().targetProxy()->isMSAADirty()) {
@@ -646,6 +650,7 @@
 
 #ifdef SK_DEBUG
 void GrDrawingManager::validate() const {
+#if SK_GPU_V1
     if (fActiveOpsTask) {
         SkASSERT(!fDAG.empty());
         SkASSERT(!fActiveOpsTask->isClosed());
@@ -676,10 +681,12 @@
     } else {
         SkASSERT(fActiveOpsTask == nullptr);
     }
+#endif // SK_GPU_V1
 }
-#endif
+#endif // SK_DEBUG
 
 void GrDrawingManager::closeActiveOpsTask() {
+#if SK_GPU_V1
     if (fActiveOpsTask) {
         // This is a temporary fix for the partial-MDB world. In that world we're not
         // reordering so ops that (in the single opsTask world) would've just glommed onto the
@@ -688,8 +695,10 @@
         fActiveOpsTask->makeClosed(fContext);
         fActiveOpsTask = nullptr;
     }
+#endif
 }
 
+#if SK_GPU_V1
 sk_sp<GrOpsTask> GrDrawingManager::newOpsTask(GrSurfaceProxyView surfaceView,
                                               sk_sp<GrArenas> arenas,
                                               bool flushTimeOpsTask) {
@@ -742,6 +751,7 @@
 
     SkDEBUGCODE(this->validate());
 }
+#endif // SK_GPU_V1
 
 GrTextureResolveRenderTask* GrDrawingManager::newTextureResolveRenderTask(const GrCaps& caps) {
     // Unlike in the "new opsTask" case, we do not want to close the active opsTask, nor (if we are
@@ -767,6 +777,7 @@
                                                                     std::move(semaphores),
                                                                     numSemaphores);
 
+#if SK_GPU_V1
     if (fActiveOpsTask && (fActiveOpsTask->target(0) == proxy.get())) {
         SkASSERT(this->getLastRenderTask(proxy.get()) == fActiveOpsTask);
         this->insertTaskBeforeLast(waitTask);
@@ -784,7 +795,9 @@
         // get a circular self dependency of waitTask on waitTask.
         waitTask->addDependenciesFromOtherTask(fActiveOpsTask);
         fActiveOpsTask->addDependency(waitTask.get());
-    } else {
+    } else
+#endif
+    {
         // In this case we just close the previous RenderTask and start and append the waitTask
         // to the DAG. Since it is the last task now we call setLastRenderTask on the proxy. If
         // there is a lastTask on the proxy we make waitTask depend on that task. This
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index b727899..af02f8c 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -48,6 +48,7 @@
 
     void freeGpuResources();
 
+#if SK_GPU_V1
     // OpsTasks created at flush time are stored and handled different from the others.
     sk_sp<GrOpsTask> newOpsTask(GrSurfaceProxyView,
                                 sk_sp<GrArenas> arenas,
@@ -58,6 +59,7 @@
     // If 'previousAtlasTask' is provided, closes it and configures dependencies to guarantee
     // previousAtlasTask and all its users are completely out of service before atlasTask executes.
     void addAtlasTask(sk_sp<GrRenderTask> atlasTask, GrRenderTask* previousAtlasTask);
+#endif
 
     // Create a render task that can resolve MSAA and/or regenerate mipmap levels on proxies. This
     // method will only add the new render task to the list. It is up to the caller to call
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 2d7f5c3..94a50ed 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -242,7 +242,6 @@
 #if GR_TEST_UTILS
     int countUniqueKeysWithTag(const char* tag) const;
 
-    // This function is for unit testing and is only defined in test tools.
     void changeTimestamp(uint32_t newTimestamp);
 #endif
 
diff --git a/src/gpu/ops/GrLatticeOp.h b/src/gpu/ops/GrLatticeOp.h
index 559dbb0..4fa1053 100644
--- a/src/gpu/ops/GrLatticeOp.h
+++ b/src/gpu/ops/GrLatticeOp.h
@@ -5,8 +5,8 @@
  * found in the LICENSE file.
  */
 
-#ifndef GLatticeOp_DEFINED
-#define GLatticeOp_DEFINED
+#ifndef GrLatticeOp_DEFINED
+#define GrLatticeOp_DEFINED
 
 #include <memory>
 #include "include/core/SkRefCnt.h"
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
index 6dd596b..13229a0 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
@@ -417,8 +417,6 @@
 }
 
 void GrPathInnerTriangulateOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
-    // TODO (robertphillips): remove guard once Ops are also V1-only
-#if SK_GPU_V1
     if (fStencilCurvesProgram) {
         SkASSERT(fTessellator);
         flushState->bindPipelineAndScissorClip(*fStencilCurvesProgram, this->bounds());
@@ -442,5 +440,4 @@
         flushState->bindTextures(fCoverHullsProgram->geomProc(), nullptr, *fPipelineForFills);
         fTessellator->drawHullInstances(flushState, fHullVertexBufferIfNoIDSupport);
     }
-#endif
 }
diff --git a/src/gpu/tessellate/GrPathStencilCoverOp.cpp b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
index 8d5d394..a638f65 100644
--- a/src/gpu/tessellate/GrPathStencilCoverOp.cpp
+++ b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
@@ -303,8 +303,6 @@
 }
 
 void GrPathStencilCoverOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
-    // TODO (robertphillips): remove guard once Ops are also V1-only
-#if SK_GPU_V1
     if (!fTessellator) {
         return;
     }
@@ -334,5 +332,4 @@
         flushState->bindBuffers(nullptr, fBBoxBuffer, fBBoxVertexBufferIfNoIDSupport);
         flushState->drawInstanced(fPathCount, fBBoxBaseInstance, 4, 0);
     }
-#endif
 }
diff --git a/src/gpu/tessellate/GrPathTessellateOp.cpp b/src/gpu/tessellate/GrPathTessellateOp.cpp
index 267c149..140156a 100644
--- a/src/gpu/tessellate/GrPathTessellateOp.cpp
+++ b/src/gpu/tessellate/GrPathTessellateOp.cpp
@@ -69,8 +69,5 @@
     flushState->bindTextures(fTessellationProgram->geomProc(), nullptr,
                              fTessellationProgram->pipeline());
 
-    // TODO (robertphillips): remove guard once Ops are also V1-only
-#if SK_GPU_V1
     fTessellator->draw(flushState);
-#endif
 }
diff --git a/src/gpu/tessellate/GrStrokeTessellateOp.cpp b/src/gpu/tessellate/GrStrokeTessellateOp.cpp
index 0126917..88fac80 100644
--- a/src/gpu/tessellate/GrStrokeTessellateOp.cpp
+++ b/src/gpu/tessellate/GrStrokeTessellateOp.cpp
@@ -244,8 +244,6 @@
 }
 
 void GrStrokeTessellateOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
-    // TODO (robertphillips): remove guard once Ops are also V1-only
-#if SK_GPU_V1
     if (fStencilProgram) {
         flushState->bindPipelineAndScissorClip(*fStencilProgram, chainBounds);
         flushState->bindTextures(fStencilProgram->geomProc(), nullptr, fStencilProgram->pipeline());
@@ -256,5 +254,4 @@
         flushState->bindTextures(fFillProgram->geomProc(), nullptr, fFillProgram->pipeline());
         fTessellator->draw(flushState);
     }
-#endif
 }
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 3979ce0..346ddaa 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -21,13 +21,13 @@
 #include "src/gpu/SkGr.h"
 #include "src/gpu/effects/GrDistanceFieldGeoProc.h"
 #include "src/gpu/geometry/GrStyledShape.h"
-#include "src/gpu/ops/GrAtlasTextOp.h"
 #include "src/gpu/text/GrAtlasManager.h"
 #include "src/gpu/text/GrStrikeCache.h"
 #include "src/gpu/text/GrTextBlob.h"
 
 #if SK_GPU_V1
 #include "src/gpu/GrBlurUtils.h"
+#include "src/gpu/ops/GrAtlasTextOp.h"
 #include "src/gpu/v1/SurfaceDrawContext_v1.h"
 #else
 #include "src/gpu/SurfaceContext.h"
@@ -1711,8 +1711,10 @@
     const SkRect fGlyphDeviceBounds;
     const SkSpan<const DevicePosition> fLeftTopDevicePos;
 
+#if SK_GPU_V1
     // Space for geometry
     alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+#endif
 
     // The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
     // be single threaded.
@@ -1729,7 +1731,6 @@
         , fGlyphs{glyphs} {
 #if !SK_GPU_V1
     (void) fGlyphDeviceBounds;
-    (void) fGeom;
 #endif
 }
 
@@ -1962,8 +1963,10 @@
     const SkRect fVertexBounds;
     const SkSpan<const VertexData> fVertexData;
 
+#if SK_GPU_V1
     // Space for geometry
     alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+#endif
 
     // The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
     // be single threaded.
@@ -1978,9 +1981,6 @@
         , fVertexBounds{bounds}
         , fVertexData{vertexData}
         , fGlyphs{glyphs} {
-#if !SK_GPU_V1
-    (void) fGeom;
-#endif
 }
 
 GrAtlasSubRunOwner TransformedMaskSubRunNoCache::Make(
@@ -2191,8 +2191,10 @@
     const SkRect fVertexBounds;
     const SkSpan<const VertexData> fVertexData;
 
+#if SK_GPU_V1
     // Space for geometry
     alignas(alignof(GrAtlasTextOp::Geometry)) char fGeom[sizeof(GrAtlasTextOp::Geometry)];
+#endif
 
     // The regenerateAtlas method mutates fGlyphs. It should be called from onPrepare which must
     // be single threaded.
@@ -2215,7 +2217,6 @@
         , fUseLCDText{useLCDText}
         , fAntiAliased{antiAliased} {
 #if !SK_GPU_V1
-    (void) fGeom;
     (void) fUseLCDText;
     (void) fAntiAliased;
 #endif