Misc batch->op cleanup Part 1 of 2

Change-Id: I80f951976558a284e55386e0a368f08bd835d8ca
Reviewed-on: https://skia-review.googlesource.com/6359
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index 147dc36..3777f2b 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -70,8 +70,8 @@
  *
  * The bench is used to test a few things. First it can test any optimizations made for a specific
  * color pattern (for example drawing an opaque bitmap versus one with partial alpha). Also it can
- * be used to test the cost of program switching and/or batching when alternating between different
- * patterns when on the gpu.
+ * be used to test the cost of program switching and/or GrDrawOp combining when alternating between
+ * different patterns when on the gpu.
  */
 class AlternatingColorPatternBench : public Benchmark {
 public:
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 7d92c9e..9d4dcc5 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -120,7 +120,7 @@
             break;
         }
 #if SK_SUPPORT_GPU
-        // Ensure the GrContext doesn't batch across draw loops.
+        // Ensure the GrContext doesn't combine ops across draw loops.
         if (GrContext* context = canvas->getGrContext()) {
             context->flush();
         }
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 50b9163..594a4b7 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1222,17 +1222,16 @@
     , fThreaded(threaded) {}
 
 DEFINE_bool(imm, false, "Run gpu configs in immediate mode.");
-DEFINE_bool(batchClip, false, "Clip each GrOp to its device bounds for testing.");
-DEFINE_int32(batchLookback, -1, "Maximum GrOp lookback for combining, negative means default.");
-DEFINE_int32(batchLookahead, -1, "Maximum GrOp lookahead for combining, negative means "
-                                 "default.");
+DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
+DEFINE_int32(opLookback, -1, "Maximum GrOp lookback for combining, negative means default.");
+DEFINE_int32(opLookahead, -1, "Maximum GrOp lookahead for combining, negative means default.");
 
 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const {
     GrContextOptions grOptions;
     grOptions.fImmediateMode = FLAGS_imm;
-    grOptions.fClipBatchToBounds = FLAGS_batchClip;
-    grOptions.fMaxBatchLookback = FLAGS_batchLookback;
-    grOptions.fMaxBatchLookahead = FLAGS_batchLookahead;
+    grOptions.fClipDrawOpsToBounds = FLAGS_drawOpClip;
+    grOptions.fMaxOpCombineLookback = FLAGS_opLookback;
+    grOptions.fMaxOpCombineLookahead = FLAGS_opLookahead;
 
     src.modifyGrContextOptions(&grOptions);
 
diff --git a/gm/croppedrects.cpp b/gm/croppedrects.cpp
index 2462519..ce7ff4b 100644
--- a/gm/croppedrects.cpp
+++ b/gm/croppedrects.cpp
@@ -22,7 +22,7 @@
  *
  * The test creates an image of a green square surrounded by red background, then draws this image
  * in various ways with the red clipped out. The test is successful if there is no visible red
- * background, scissor is never used, and ideally, all the rectangles draw in one batch.
+ * background, scissor is never used, and ideally, all the rectangles draw in one GrDrawOp.
  */
 class CroppedRectsGM : public GM {
 private:
@@ -95,7 +95,7 @@
             canvas->drawPath(path, paint);
         }
 
-        // TODO: assert the draw target only has one batch in the post-MDB world.
+        // TODO: assert the draw target only has one op in the post-MDB world.
     }
 
     sk_sp<SkImage> fSrcImage;
diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp
index eccf04c..4a1417c 100644
--- a/gm/drawminibitmaprect.cpp
+++ b/gm/drawminibitmaprect.cpp
@@ -63,8 +63,8 @@
 constexpr int gSize = 1024;
 constexpr int gSurfaceSize = 2048;
 
-// This GM calls drawImageRect several times using the same texture. This is
-// intended to exercise batching of these calls.
+// This GM calls drawImageRect several times using the same texture. This is intended to exercise
+// combining GrDrawOps during these calls.
 class DrawMiniBitmapRectGM : public skiagm::GM {
 public:
     DrawMiniBitmapRectGM(bool antiAlias) : fAA(antiAlias) {
diff --git a/gm/dstreadshuffle.cpp b/gm/dstreadshuffle.cpp
index b038fdb..11aa291 100644
--- a/gm/dstreadshuffle.cpp
+++ b/gm/dstreadshuffle.cpp
@@ -156,8 +156,8 @@
                             SkPaint p;
                             p.setAntiAlias(true);
                             p.setColor(color);
-                            // In order to get some batching on the GPU backend we do 2 src over for
-                            // each xfer mode which requires a dst read
+                            // In order to get some op combining on the GPU backend we do 2 src over
+                            // for each xfer mode which requires a dst read
                             p.setBlendMode(r % 3 == 0 ? SkBlendMode::kLighten :
                                                         SkBlendMode::kSrcOver);
                             SetStyle(&p, style, width);
diff --git a/gm/textblobblockreordering.cpp b/gm/textblobblockreordering.cpp
index c581e13..b1658f8 100644
--- a/gm/textblobblockreordering.cpp
+++ b/gm/textblobblockreordering.cpp
@@ -46,9 +46,9 @@
         return SkISize::Make(kWidth, kHeight);
     }
 
-    // This draws the same text blob 3 times.  The second draw used a different
-    // xfer mode so it doens't get batched with the first and third.
-    // ultimately thye iwll be flushed in the order first, third, and then second
+    // This draws the same text blob 3 times.  The second draw used a different xfer mode so its
+    // GrDrawOp doesn't get combined with the first and third. Ultimately, they will be flushed in
+    // the order first, third, and then second.
     void onDraw(SkCanvas* canvas) override {
         canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorGRAY));
 
@@ -63,8 +63,7 @@
 
         canvas->translate(SkIntToScalar(xDelta), SkIntToScalar(yDelta));
 
-	// draw a rect where the text should be, and then twiddle the xfermode
-        // so we don't batch
+        // Draw a rect where the text should be, and then twiddle the xfermode so we don't combine.
         SkPaint redPaint;
         redPaint.setColor(SK_ColorRED);
         canvas->drawRect(bounds, redPaint);
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index b17bb70..9ee8ff6 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -13,7 +13,7 @@
 
 /**
  * Draws text with random parameters. The text draws each get their own clip rect. It is also
- * used as a bench to measure how well the GPU backend batches text draws.
+ * used as a bench to measure how well the GPU backend combines draw ops for text draws.
  */
 
 class VariedTextGM : public skiagm::GM {
diff --git a/gn/gpu.gni b/gn/gpu.gni
index eee9003..a635401 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -348,7 +348,7 @@
   "$_src/gpu/text/GrAtlasGlyphCache.cpp",
   "$_src/gpu/text/GrAtlasGlyphCache.h",
   "$_src/gpu/text/GrAtlasTextBlob.cpp",
-  "$_src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp",
+  "$_src/gpu/text/GrAtlasTextBlob_regenInOp.cpp",
   "$_src/gpu/text/GrAtlasTextBlob.h",
   "$_src/gpu/text/GrAtlasTextContext.cpp",
   "$_src/gpu/text/GrAtlasTextContext.h",
diff --git a/gyp/gmslides.gypi b/gyp/gmslides.gypi
index d318a53..66cfc6c 100644
--- a/gyp/gmslides.gypi
+++ b/gyp/gmslides.gypi
@@ -22,7 +22,6 @@
         '<!@(python find.py "*.c*" ../gm)',
 
         # Files needed by particular GMs
-        '../src/gpu/batches/GrTestBatch.h',
         '../tools/debugger/SkDrawCommand.h',
         '../tools/debugger/SkDrawCommand.cpp',
         '../tools/debugger/SkDebugCanvas.h',
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 65daf72..ac38470 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -39,14 +39,14 @@
         immediately. Intended to ease debugging. */
     bool fImmediateMode = false;
 
-    /** For debugging purposes turn each GrOp's bounds into a clip rect. This is used to
+    /** For debugging purposes turn each GrDrawOp's bounds into a clip rect. This is used to
         verify that the clip bounds are conservative. */
-    bool fClipBatchToBounds = false;
+    bool fClipDrawOpsToBounds = false;
 
     /** For debugging, override the default maximum look-back or look-ahead window for GrOp
         combining. */
-    int fMaxBatchLookback = -1;
-    int fMaxBatchLookahead = -1;
+    int fMaxOpCombineLookback = -1;
+    int fMaxOpCombineLookahead = -1;
 
     /** Force us to do all swizzling manually in the shader and don't rely on extensions to do
         swizzling. */
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index ba9daf7..ce09762 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -27,7 +27,7 @@
  * While a GrProgramElement is ref'ed any resources it owns are also ref'ed. However, once it gets
  * into the state where it has pending executions AND no refs then it converts its ownership of
  * its GrGpuResources from refs to pending IOs. The pending IOs allow the cache to track when it is
- * safe to recycle a resource even though we still have buffered GrBatches that read or write to the
+ * safe to recycle a resource even though we still have buffered GrOps that read or write to the
  * the resource.
  *
  * To make this work all GrGpuResource objects owned by a GrProgramElement or derived classes
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 9a920a2..d5fa9e0 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -107,21 +107,21 @@
         /**
          * The draw can be skipped completely.
          */
-        kSkipDraw_OptFlag                 = 0x1,
+        kSkipDraw_OptFlag = 0x1,
         /**
          * GrXferProcessor will ignore color, thus no need to provide
          */
-        kIgnoreColor_OptFlag              = 0x2,
+        kIgnoreColor_OptFlag = 0x2,
         /**
          * GrXferProcessor will ignore coverage, thus no need to provide
          */
-        kIgnoreCoverage_OptFlag           = 0x4,
+        kIgnoreCoverage_OptFlag = 0x4,
         /**
          * Clear color stages and override input color to that returned by getOptimizations
          */
-        kOverrideColor_OptFlag            = 0x8,
+        kOverrideColor_OptFlag = 0x8,
         /**
-         * Can tweak alpha for coverage. Currently this flag should only be used by a batch
+         * Can tweak alpha for coverage. Currently this flag should only be used by a GrDrawOp.
          */
         kCanTweakAlphaForCoverage_OptFlag = 0x20,
     };
diff --git a/samplecode/SampleCode.cpp b/samplecode/SampleCode.cpp
index bb55119..a64c0e2 100644
--- a/samplecode/SampleCode.cpp
+++ b/samplecode/SampleCode.cpp
@@ -153,7 +153,7 @@
         SkAutoCanvasRestore acr(canvas, true);
         this->onDrawContent(canvas);
 #if SK_SUPPORT_GPU
-        // Ensure the GrContext doesn't batch across draw loops.
+        // Ensure the GrContext doesn't combine GrDrawOps across draw loops.
         if (GrContext* context = canvas->getGrContext()) {
             context->flush();
         }
diff --git a/samplecode/SampleManyRects.cpp b/samplecode/SampleManyRects.cpp
index b5eb6b0..66274a4 100644
--- a/samplecode/SampleManyRects.cpp
+++ b/samplecode/SampleManyRects.cpp
@@ -12,7 +12,7 @@
 #include "SkView.h"
 
 /**
- * Animated sample used to develop batched rect implementation in GrBufferedDrawTarget.
+ * Animated sample used to develop a predecessor of GrDrawOp combining.
  */
 class ManyRectsView : public SampleView {
 private:
@@ -44,8 +44,7 @@
             canvas->save();
 
             canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
-            // Rotation messes up the GPU batching because of the clip below. We don't notice
-            // that the rect is inside the clip so the clip changes interrupt batching.
+            // Uncomment to test rotated rect draw combining.
             if (false) {
                 SkMatrix rotate;
                 rotate.setRotate(fRandom.nextUScalar1() * 360,
@@ -54,7 +53,7 @@
                 canvas->concat(rotate);
             }
             SkRect clipRect = rect;
-            // This clip will always contain the entire rect. It's here to give the GPU batching
+            // This clip will always contain the entire rect. It's here to give the GPU op combining
             // code a little more challenge.
             clipRect.outset(10, 10);
             canvas->clipRect(clipRect);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f1a080f..8cbe701 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -94,9 +94,9 @@
     fDidTestPMConversions = false;
 
     GrRenderTargetOpList::Options rtOpListOptions;
-    rtOpListOptions.fClipBatchToBounds = options.fClipBatchToBounds;
-    rtOpListOptions.fMaxBatchLookback = options.fMaxBatchLookback;
-    rtOpListOptions.fMaxBatchLookahead = options.fMaxBatchLookahead;
+    rtOpListOptions.fClipDrawOpsToBounds = options.fClipDrawOpsToBounds;
+    rtOpListOptions.fMaxOpCombineLookback = options.fMaxOpCombineLookback;
+    rtOpListOptions.fMaxOpCombineLookahead = options.fMaxOpCombineLookahead;
     GrPathRendererChain::Options prcOptions;
     prcOptions.fDisableDistanceFieldRenderer = options.fDisableDistanceFieldPaths;
     prcOptions.fAllowPathMaskCaching = options.fAllowPathMaskCaching;
diff --git a/src/gpu/GrDefaultGeoProcFactory.h b/src/gpu/GrDefaultGeoProcFactory.h
index 022930b6..688fcc9 100644
--- a/src/gpu/GrDefaultGeoProcFactory.h
+++ b/src/gpu/GrDefaultGeoProcFactory.h
@@ -12,9 +12,7 @@
 
 /*
  * A factory for creating default Geometry Processors which simply multiply position by the uniform
- * view matrix and wire through color, coverage, UV coords if requested.  Right now this is only
- * used in the creation of optimized draw states because adding default GPs to the drawstate can
- * interfere with batching due to updating the drawstate.
+ * view matrix and wire through color, coverage, UV coords if requested.
  */
 namespace GrDefaultGeoProcFactory {
     // Structs for adding vertex attributes
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 9cbdbbe..515e26e 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -83,8 +83,8 @@
         fOpLists[i]->prepareOps(&fFlushState);
     }
 
-    // Enable this to print out verbose batching information
 #if 0
+    // Enable this to print out verbose GrOp information
     for (int i = 0; i < fOpLists.count(); ++i) {
         SkDEBUGCODE(fOpLists[i]->dump();)
     }
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index bc6f6eb..2711b9a 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -64,7 +64,6 @@
      * 1) LocalCoordTransform * Position - in Shader
      * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader
      * 3) A transformation on the CPU uploaded via vertex attribute
-     * TODO make this GrBatches responsibility
      */
     enum LocalCoordsType {
         kUnused_LocalCoordsType,
diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h
index 879de49..332b0e5 100644
--- a/src/gpu/GrGpuCommandBuffer.h
+++ b/src/gpu/GrGpuCommandBuffer.h
@@ -24,7 +24,7 @@
 /**
  * The GrGpuCommandBuffer is a series of commands (draws, clears, and discards), which all target
  * the same render target. It is possible that these commands execute immediately (GL), or get
- * buffered up for later execution (Vulkan). GrBatches will execute their draw commands into a
+ * buffered up for later execution (Vulkan). GrOps will execute their draw commands into a
  * GrGpuCommandBuffer.
  *
  * Ideally we'd know the GrRenderTarget, or at least its properties when the GrGpuCommandBuffer, is
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 16d3968..ed77c3b 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -5,8 +5,8 @@
  * found in the LICENSE file.
  */
 
-#ifndef GrBatchBuffer_DEFINED
-#define GrBatchBuffer_DEFINED
+#ifndef GrOpFlushState_DEFINED
+#define GrOpFlushState_DEFINED
 
 #include "GrBufferAllocPool.h"
 #include "GrGpu.h"
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index e95c7c2..e49dad4 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -96,9 +96,9 @@
     static bool AreEqual(const GrPipeline& a, const GrPipeline& b);
 
     /**
-     * Allows a GrOp subclass to determine whether two GrBatches can combine. This is a stricter
-     * test than isEqual because it also considers blend barriers when the two batches' bounds
-     * overlap
+     * Allows a GrOp subclass to determine whether two GrOp instances can combine. This is a
+     * stricter test than isEqual because it also considers blend barriers when the two ops'
+     * bounds overlap
      */
     static bool CanCombine(const GrPipeline& a, const SkRect& aBounds,
                            const GrPipeline& b, const SkRect& bBounds,
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index f5f159f..1bc9002 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -292,7 +292,7 @@
 
     ///////////////////////////////////////////////////////////////////////////
 
-    bool usePLSDstRead(const GrDrawOp* batch) const;
+    bool usePLSDstRead(const GrDrawOp*) const;
 
 private:
     // Some of the auto restore objects assume that no effects are removed during their lifetime.
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 4cc1112..ed2b2e3 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -18,7 +18,7 @@
  * responsible for providing a color and coverage input into the Ganesh rendering pipeline.  Through
  * optimization, Ganesh may decide a different color, no color, and / or no coverage are required
  * from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to support this
- * functionality.  We also use the GrPrimitiveProcessor to make batching decisions.
+ * functionality.
  *
  * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the
  * GrPrimitiveProcessor.  These loops run on the CPU and compute any invariant components which
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 4eeef57..0d380a1 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -42,9 +42,9 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-// Experimentally we have found that most batching occurs within the first 10 comparisons.
-static const int kDefaultMaxBatchLookback  = 10;
-static const int kDefaultMaxBatchLookahead = 10;
+// Experimentally we have found that most combining occurs within the first 10 comparisons.
+static const int kDefaultMaxOpLookback = 10;
+static const int kDefaultMaxOpLookahead = 10;
 
 GrRenderTargetOpList::GrRenderTargetOpList(GrRenderTargetProxy* rtp, GrGpu* gpu,
                                            GrResourceProvider* resourceProvider,
@@ -57,11 +57,11 @@
     // TODO: Stop extracting the context (currently needed by GrClip)
     fContext = fGpu->getContext();
 
-    fClipOpToBounds = options.fClipBatchToBounds;
-    fMaxOpLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
-                                                          options.fMaxBatchLookback;
-    fMaxOpLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLookahead :
-                                                           options.fMaxBatchLookahead;
+    fClipOpToBounds = options.fClipDrawOpsToBounds;
+    fMaxOpLookback = (options.fMaxOpCombineLookback < 0) ? kDefaultMaxOpLookback
+                                                         : options.fMaxOpCombineLookback;
+    fMaxOpLookahead = (options.fMaxOpCombineLookahead < 0) ? kDefaultMaxOpLookahead
+                                                           : options.fMaxOpCombineLookahead;
 
     if (GrCaps::InstancedSupport::kNone != this->caps()->instancedSupport()) {
         fInstancedRendering.reset(fGpu->createInstancedRendering());
@@ -98,9 +98,9 @@
 
 void GrRenderTargetOpList::setupDstTexture(GrRenderTarget* rt,
                                            const GrClip& clip,
-                                           const SkRect& batchBounds,
+                                           const SkRect& opBounds,
                                            GrXferProcessor::DstTexture* dstTexture) {
-    SkRect bounds = batchBounds;
+    SkRect bounds = opBounds;
     bounds.outset(0.5f, 0.5f);
 
     if (this->caps()->textureBarrierSupport()) {
@@ -235,10 +235,10 @@
     }
 }
 
-static void batch_bounds(SkRect* bounds, const GrOp* batch) {
-    *bounds = batch->bounds();
-    if (batch->hasZeroArea()) {
-        if (batch->hasAABloat()) {
+static void op_bounds(SkRect* bounds, const GrOp* op) {
+    *bounds = op->bounds();
+    if (op->hasZeroArea()) {
+        if (op->hasAABloat()) {
             bounds->outset(0.5f, 0.5f);
         } else {
             // We don't know which way the particular GPU will snap lines or points at integer
@@ -267,7 +267,7 @@
                                      sk_sp<GrDrawOp> op) {
     // Setup clip
     SkRect bounds;
-    batch_bounds(&bounds, op.get());
+    op_bounds(&bounds, op.get());
     GrAppliedClip appliedClip(bounds);
     if (!clip.apply(fContext, renderTargetContext, pipelineBuilder.isHWAntialias(),
                     pipelineBuilder.hasUserStencilSettings(), &appliedClip)) {
@@ -554,7 +554,7 @@
             }
             ++j;
             if (j > maxCandidateIdx) {
-                GrOP_INFO("\t\tReached max lookahead or end of batch array %d\n", i);
+                GrOP_INFO("\t\tReached max lookahead or end of op array %d\n", i);
                 break;
             }
         }
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 5b2e5e1..a2b323f 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -41,13 +41,9 @@
 public:
     /** Options for GrRenderTargetOpList behavior. */
     struct Options {
-        Options ()
-            : fClipBatchToBounds(false)
-            , fMaxBatchLookback(-1)
-            , fMaxBatchLookahead(-1) {}
-        bool fClipBatchToBounds;
-        int  fMaxBatchLookback;
-        int  fMaxBatchLookahead;
+        bool fClipDrawOpsToBounds = false;
+        int fMaxOpCombineLookback = -1;
+        int fMaxOpCombineLookahead = -1;
     };
 
     GrRenderTargetOpList(GrRenderTargetProxy*, GrGpu*, GrResourceProvider*,
@@ -150,7 +146,7 @@
     // a texture copy could not be made.
     void setupDstTexture(GrRenderTarget*,
                          const GrClip&,
-                         const SkRect& drawOpBounds,
+                         const SkRect& opBounds,
                          GrXferProcessor::DstTexture*);
 
     // Used only via GrRenderTargetContextPriv.
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index e18718e..d74807a 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -33,7 +33,7 @@
                                                                const GrUniqueKey& key) {
     size_t bufferSize = patternSize * reps * sizeof(uint16_t);
 
-    // This is typically used in GrBatchs, so we assume kNoPendingIO.
+    // This is typically used in GrMeshDrawOps, so we assume kNoPendingIO.
     GrBuffer* buffer = this->createBuffer(bufferSize, kIndex_GrBufferType, kStatic_GrAccessPattern,
                                           kNoPendingIO_Flag);
     if (!buffer) {
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8adc76e..b082241 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -666,8 +666,8 @@
             // Path-based stroking looks better for thin rects
             SkScalar strokeWidth = draw.fMatrix->getMaxScale() * paint.getStrokeWidth();
             if (strokeWidth >= 1.0f) {
-                // Round capping support is currently disabled b.c. it would require
-                // a RRect batch that takes a localMatrix.
+                // Round capping support is currently disabled b.c. it would require a RRect
+                // GrDrawOp that takes a localMatrix.
                 this->drawStrokedLine(points, draw, paint);
                 return;
             }
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 7dc0893..9556146 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -152,10 +152,10 @@
                                           const SkMatrix& srcToDstMatrix,
                                           const GrClip& clip,
                                           const SkPaint& paint) {
-    // Specifying the texture coords as local coordinates is an attempt to enable more batching
-    // by not baking anything about the srcRect, dstRect, or viewMatrix, into the texture FP. In
-    // the future this should be an opaque optimization enabled by the combination of batch/GP and
-    // FP.
+    // Specifying the texture coords as local coordinates is an attempt to enable more GrDrawOp
+    // combining by not baking anything about the srcRect, dstRect, or viewMatrix, into the texture
+    // FP. In the future this should be an opaque optimization enabled by the combination of
+    // GrDrawOp/GP and FP.
     const SkMaskFilter* mf = paint.getMaskFilter();
     // The shader expects proper local coords, so we can't replace local coords with texture coords
     // if the shader will be used. If we have a mask filter we will change the underlying geometry
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 5a0864e..d3adc28 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -436,10 +436,10 @@
     // On many GPUs, map memory is very expensive, so we effectively disable it here by setting the
     // threshold to the maximum unless the client gives us a hint that map memory is cheap.
     if (fBufferMapThreshold < 0) {
-        // We think mapping on Chromium will be cheaper once we know ahead of time how much space
-        // we will use for all GrBatchs. Right now we might wind up mapping a large buffer and using
-        // a small subset.
 #if 0
+        // We think mapping on Chromium will be cheaper once we know ahead of time how much space
+        // we will use for all GrMeshDrawOps. Right now we might wind up mapping a large buffer and
+        // using a small subset.
         fBufferMapThreshold = kChromium_GrGLDriver == ctxInfo.driver() ? 0 : SK_MaxS32;
 #else
         fBufferMapThreshold = SK_MaxS32;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 80c7f61..577aca8 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2810,7 +2810,7 @@
                                                 sizeof(uint16_t) * nonInstMesh->startIndex());
                 // info.startVertex() was accounted for by setupGeometry.
                 if (this->glCaps().drawRangeElementsSupport()) {
-                    // We assume here that the batch that generated the mesh used the full
+                    // We assume here that the GrMeshDrawOps that generated the mesh used the full
                     // 0..vertexCount()-1 range.
                     int start = 0;
                     int end = nonInstMesh->vertexCount() - 1;
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index bd05d44..c4c9170 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -131,9 +131,9 @@
         size_t byteCount;
         void* blobVertices;
         int subRunGlyphCount;
-        blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun, &glyphCache,
-                           vertexStride, args.fViewMatrix, args.fX, args.fY, args.fColor,
-                           &blobVertices, &byteCount, &subRunGlyphCount);
+        blob->regenInOp(target, fFontCache, &helper, args.fRun, args.fSubRun, &glyphCache,
+                        vertexStride, args.fViewMatrix, args.fX, args.fY, args.fColor,
+                        &blobVertices, &byteCount, &subRunGlyphCount);
 
         // now copy all vertices
         memcpy(currVertex, blobVertices, byteCount);
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index bf42d5d..9aca37a 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -268,7 +268,7 @@
         subRunColor = color;
     }
 
-    sk_sp<GrAtlasTextOp> batch;
+    sk_sp<GrAtlasTextOp> op;
     if (info.drawAsDistanceFields()) {
         SkColor filteredColor;
         SkColorFilter* colorFilter = skPaint.getColorFilter();
@@ -278,13 +278,13 @@
             filteredColor = skPaint.getColor();
         }
         bool useBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
-        batch = GrAtlasTextOp::MakeDistanceField(glyphCount, cache, distanceAdjustTable,
-                                                 useGammaCorrectDistanceTable, filteredColor,
-                                                 info.hasUseLCDText(), useBGR);
+        op = GrAtlasTextOp::MakeDistanceField(glyphCount, cache, distanceAdjustTable,
+                                              useGammaCorrectDistanceTable, filteredColor,
+                                              info.hasUseLCDText(), useBGR);
     } else {
-        batch = GrAtlasTextOp::MakeBitmap(format, glyphCount, cache);
+        op = GrAtlasTextOp::MakeBitmap(format, glyphCount, cache);
     }
-    GrAtlasTextOp::Geometry& geometry = batch->geometry();
+    GrAtlasTextOp::Geometry& geometry = op->geometry();
     geometry.fViewMatrix = viewMatrix;
     geometry.fBlob = SkRef(this);
     geometry.fRun = run;
@@ -292,9 +292,9 @@
     geometry.fColor = subRunColor;
     geometry.fX = x;
     geometry.fY = y;
-    batch->init();
+    op->init();
 
-    return std::move(batch);
+    return std::move(op);
 }
 
 inline
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 0028cc1..9b3f59c 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -260,14 +260,14 @@
     }
 
     /**
-     * Consecutive calls to regenInBatch often use the same SkGlyphCache. If the same instance of
-     * SkAutoGlyphCache is passed to multiple calls of regenInBatch then it can save the cost of
+     * Consecutive calls to regenInOp often use the same SkGlyphCache. If the same instance of
+     * SkAutoGlyphCache is passed to multiple calls of regenInOp then it can save the cost of
      * multiple detach/attach operations of SkGlyphCache.
      */
-    void regenInBatch(GrDrawOp::Target* target, GrAtlasGlyphCache* fontCache,
-                      GrBlobRegenHelper *helper, int run, int subRun, SkAutoGlyphCache*,
-                      size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
-                      GrColor color, void** vertices, size_t* byteCount, int* glyphCount);
+    void regenInOp(GrDrawOp::Target* target, GrAtlasGlyphCache* fontCache,
+                   GrBlobRegenHelper* helper, int run, int subRun, SkAutoGlyphCache*,
+                   size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
+                   GrColor color, void** vertices, size_t* byteCount, int* glyphCount);
 
     const Key& key() const { return fKey; }
 
diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInOp.cpp
similarity index 95%
rename from src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
rename to src/gpu/text/GrAtlasTextBlob_regenInOp.cpp
index 9a37e42..3150988 100644
--- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
+++ b/src/gpu/text/GrAtlasTextBlob_regenInOp.cpp
@@ -241,13 +241,13 @@
 #define REGEN_ARGS target, fontCache, helper, &run, &info, lazyCache, \
                    *glyphCount, vertexStride, color, transX, transY
 
-void GrAtlasTextBlob::regenInBatch(GrDrawOp::Target* target,
-                                   GrAtlasGlyphCache* fontCache,
-                                   GrBlobRegenHelper *helper,
-                                   int runIndex, int subRunIndex, SkAutoGlyphCache* lazyCache,
-                                   size_t vertexStride, const SkMatrix& viewMatrix,
-                                   SkScalar x, SkScalar y, GrColor color,
-                                   void** vertices, size_t* byteCount, int* glyphCount) {
+void GrAtlasTextBlob::regenInOp(GrDrawOp::Target* target,
+                                GrAtlasGlyphCache* fontCache,
+                                GrBlobRegenHelper* helper,
+                                int runIndex, int subRunIndex, SkAutoGlyphCache* lazyCache,
+                                size_t vertexStride, const SkMatrix& viewMatrix,
+                                SkScalar x, SkScalar y, GrColor color,
+                                void** vertices, size_t* byteCount, int* glyphCount) {
     Run& run = fRuns[runIndex];
     Run::SubRunInfo& info = run.fSubRunInfo[subRunIndex];
 
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index e1a3675..3c155e3 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -417,8 +417,8 @@
     SkScalar x = SkIntToScalar(xInt);
     SkScalar y = SkIntToScalar(yInt);
 
-    // right now we don't handle textblobs, nor do we handle drawPosText.  Since we only
-    // intend to test the batch with this unit test, that is okay.
+    // right now we don't handle textblobs, nor do we handle drawPosText. Since we only intend to
+    // test the text op with this unit test, that is okay.
     sk_sp<GrAtlasTextBlob> blob(GrAtlasTextContext::CreateDrawTextBlob(
             context->getTextBlobCache(), context->getAtlasGlyphCache(),
             *context->caps()->shaderCaps(), grPaint, skPaint,
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index ed77e5c..e3ad1a7 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -629,7 +629,7 @@
         // the entire dst. Realistically this is a moot point, because any context that supports
         // NV_path_rendering will also support NV_blend_equation_advanced.
         // For clipping we'll just skip any optimizations based on the bounds. This does, however,
-        // hurt batching.
+        // hurt GrOp combining.
         const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(),
                                               renderTargetContext->height());
 
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index d43e65f..3530b88 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -60,7 +60,7 @@
     return *rtc != nullptr;
 }
 
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     static const int kW = 10;
     static const int kH = 10;
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index e1910f4..ce89793 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1094,7 +1094,7 @@
 
         TestLCDCoverageOp() : INHERITED(ClassID()) {}
 
-        const char* name() const override { return "Test LCD Text Batch"; }
+        const char* name() const override { return "Test LCD Text Op"; }
 
     private:
         void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 0c7c142..9cb2f8a 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -25,19 +25,19 @@
 #include "ops/GrMeshDrawOp.h"
 
 namespace {
-class Batch : public GrMeshDrawOp {
+class Op : public GrMeshDrawOp {
 public:
     DEFINE_OP_CLASS_ID
 
-    const char* name() const override { return "Dummy Batch"; }
+    const char* name() const override { return "Dummy Op"; }
 
-    Batch(int numAttribs)
-        : INHERITED(ClassID())
-        , fNumAttribs(numAttribs) {
+    static sk_sp<GrDrawOp> Make(int numAttribs) { return sk_sp<GrDrawOp>(new Op(numAttribs)); }
+
+private:
+    Op(int numAttribs) : INHERITED(ClassID()), fNumAttribs(numAttribs) {
         this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo);
     }
 
-private:
     void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
         input->pipelineColorInput()->setUnknownFourComponents();
         input->pipelineCoverageInput()->setUnknownSingleComponent();
@@ -121,20 +121,18 @@
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
-    sk_sp<GrDrawOp> op;
     GrPaint grPaint;
     // This one should succeed.
-    op.reset(new Batch(attribCnt));
-    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
+    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                      Op::Make(attribCnt));
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
     context->resetGpuStats();
-    // This one should fail.
-    op.reset(new Batch(attribCnt+1));
-    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
+    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                      Op::Make(attribCnt + 1));
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 77ec2db..c285721 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -102,7 +102,7 @@
 
             check_refs(reporter, sProxy.get(), 1, 1, 0, 1);
 
-            // In the deferred case, the discard batch created on instantiation adds an
+            // In the deferred case, the discard op created on instantiation adds an
             // extra ref and write
             bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
                                        caps.discardRenderTargetSupport();
@@ -122,7 +122,7 @@
 
             check_refs(reporter, sProxy.get(), 1, 1, 1, 0);
 
-            // In the deferred case, the discard batch created on instantiation adds an
+            // In the deferred case, the discard op created on instantiation adds an
             // extra ref and write
             bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
                                        caps.discardRenderTargetSupport();
@@ -142,7 +142,7 @@
 
             check_refs(reporter, sProxy.get(), 1, 1, 1, 1);
 
-            // In the deferred case, the discard batch created on instantiation adds an
+            // In the deferred case, the discard op created on instantiation adds an
             // extra ref and write
             bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
                                        caps.discardRenderTargetSupport();
@@ -150,7 +150,7 @@
 
             sProxy->instantiate(provider);
 
-            // In the deferred case, this checks that the refs transfered to the GrSurface
+            // In the deferred case, this checks that the refs transferred to the GrSurface
             check_refs(reporter, sProxy.get(), 1, 1, 1, expectedWrites);
         }
 
@@ -168,7 +168,7 @@
 
             sProxy->instantiate(provider);
 
-            // In the deferred case, this checks that the refs transfered to the GrSurface
+            // In the deferred case, this checks that the refs transferred to the GrSurface
             check_refs(reporter, sProxy.get(), 3, 3, 0, expectedWrites);
 
             sProxy->unref();