Rename testingOnly_drawBatch to testingOnly_addDrawOp and sk_sp

Change-Id: I35efd4ad2b7132145c1e477f0b1f283276e9fad5
Reviewed-on: https://skia-review.googlesource.com/5704
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 9a1990b..73af7e4 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -192,11 +192,12 @@
                     GrPaint grPaint;
                     grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
 
-                    sk_sp<GrDrawOp> batch = sk_make_sp<BezierCubicOrConicTestBatch>(
-                            gp, bounds, color, klmEqs, klmSigns[c]);
+                    sk_sp<GrDrawOp> op = sk_make_sp<BezierCubicOrConicTestBatch>(gp, bounds, color,
+                                                                                 klmEqs,
+                                                                                 klmSigns[c]);
 
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                 }
                 ++col;
                 if (numCols == col) {
@@ -325,11 +326,11 @@
                     GrPaint grPaint;
                     grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
 
-                    sk_sp<GrDrawOp> batch(
-                        new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f));
+                    sk_sp<GrDrawOp> op(new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs,
+                                                                       1.f));
 
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                 }
                 ++col;
                 if (numCols == col) {
@@ -538,10 +539,10 @@
 
                     GrPathUtils::QuadUVMatrix DevToUV(pts);
 
-                    sk_sp<GrDrawOp> batch(new BezierQuadTestBatch(gp, bounds, color, DevToUV));
+                    sk_sp<GrDrawOp> op(new BezierQuadTestBatch(gp, bounds, color, DevToUV));
 
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                 }
                 ++col;
                 if (numCols == col) {
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index 9750d90..8921a14 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -87,11 +87,11 @@
                     SkRect bounds = testBounds;
                     bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
 
-                    sk_sp<GrDrawOp> batch(
+                    sk_sp<GrDrawOp> op(
                             GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds,
                                                                 nullptr, nullptr));
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                 }
             canvas->restore();
             x = x + fTestOffsetX;
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index 67b2b33..60f90a5 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -109,11 +109,11 @@
 
                     grPaint.addColorFragmentProcessor(std::move(fp));
 
-                    sk_sp<GrDrawOp> batch(
+                    sk_sp<GrDrawOp> op(
                             GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix,
                                                                 renderRect, nullptr, nullptr));
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
 
                     // Draw labels for the input to the processor and the processor to the right of
                     // the test rect. The input label appears above the processor label.
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index c7a5d0c..9903c39 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -183,10 +183,10 @@
                 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
                 grPaint.addCoverageFragmentProcessor(std::move(fp));
 
-                sk_sp<GrDrawOp> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000));
+                sk_sp<GrDrawOp> op(new PolyBoundsBatch(p.getBounds(), 0xff000000));
 
-                renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                  batch.get());
+                renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                  std::move(op));
 
                 x += SkScalarCeilToScalar(path->getBounds().width() + kDX);
             }
@@ -223,10 +223,10 @@
                 grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
                 grPaint.addCoverageFragmentProcessor(std::move(fp));
 
-                sk_sp<GrDrawOp> batch(new PolyBoundsBatch(rect, 0xff000000));
+                sk_sp<GrDrawOp> op(new PolyBoundsBatch(rect, 0xff000000));
 
-                renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                  batch.get());
+                renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                  std::move(op));
 
                 x += SkScalarCeilToScalar(rect.width() + kDX);
             }
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index a3b31d5..43b06eb 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -115,12 +115,12 @@
                             SkRect bounds = rrect.getBounds();
                             bounds.outset(2.f, 2.f);
 
-                            sk_sp<GrDrawOp> batch(
+                            sk_sp<GrDrawOp> op(
                                     GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(),
                                                                         bounds, nullptr, nullptr));
-                            renderTargetContext->priv().testingOnly_drawBatch(grPaint,
+                            renderTargetContext->priv().testingOnly_addDrawOp(grPaint,
                                                                               GrAAType::kNone,
-                                                                              batch.get());
+                                                                              std::move(op));
                         } else {
                             drew = false;
                         }
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index a3176ad..882f14d 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -126,11 +126,11 @@
                     const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y);
                     grPaint.addColorFragmentProcessor(std::move(fp));
 
-                    sk_sp<GrDrawOp> batch(
+                    sk_sp<GrDrawOp> op(
                             GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
                                                                 renderRect, nullptr, nullptr));
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                     x += renderRect.width() + kTestPad;
                 }
                 y += renderRect.height() + kTestPad;
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index d4539ea..168571c 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -123,11 +123,11 @@
                     SkMatrix viewMatrix;
                     viewMatrix.setTranslate(x, y);
                     grPaint.addColorFragmentProcessor(std::move(fp));
-                    sk_sp<GrDrawOp> batch(
+                    sk_sp<GrDrawOp> op(
                             GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
                                                                 renderRect, nullptr, nullptr));
-                    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                      batch.get());
+                    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                      std::move(op));
                 }
                 x += renderRect.width() + kTestPad;
             }
@@ -237,10 +237,10 @@
                 SkMatrix viewMatrix;
                 viewMatrix.setTranslate(x, y);
                 grPaint.addColorFragmentProcessor(fp);
-                sk_sp<GrDrawOp> batch(GrRectBatchFactory::CreateNonAAFill(
+                sk_sp<GrDrawOp> op(GrRectBatchFactory::CreateNonAAFill(
                     GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr));
-                renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                                  batch.get());
+                renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                                  std::move(op));
             }
         }
     }
diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h
index d53bd56..b3bd72a 100644
--- a/src/gpu/GrRenderTargetContextPriv.h
+++ b/src/gpu/GrRenderTargetContextPriv.h
@@ -108,9 +108,9 @@
         return fRenderTargetContext->fRenderTargetProxy->uniqueID();
     }
 
-    void testingOnly_drawBatch(const GrPaint&,
+    void testingOnly_addDrawOp(const GrPaint&,
                                GrAAType,
-                               GrDrawOp* batch,
+                               sk_sp<GrDrawOp>,
                                const GrUserStencilSettings* = nullptr,
                                bool snapToCenters = false);
 
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index bddbee1..3335237 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -327,8 +327,8 @@
 
         GrPaint grPaint;
 
-        sk_sp<GrDrawOp> batch(GrRandomDrawBatch(&random, context));
-        SkASSERT(batch);
+        sk_sp<GrDrawOp> op(GrRandomDrawBatch(&random, context));
+        SkASSERT(op);
 
         GrProcessorTestData ptd(&random, context, context->caps(),
                                 renderTargetContext.get(), dummyTextures);
@@ -341,7 +341,7 @@
         static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage};
         GrAAType aaType = kAATypes[random.nextULessThan(SK_ARRAY_COUNT(kAATypes))];
 
-        renderTargetContext->priv().testingOnly_drawBatch(grPaint, aaType, batch.get(), uss,
+        renderTargetContext->priv().testingOnly_addDrawOp(grPaint, aaType, std::move(op), uss,
                                                           snapToCenters);
     }
     // Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
@@ -363,8 +363,8 @@
     for (int i = 0; i < fpFactoryCnt; ++i) {
         // Since FP factories internally randomize, call each 10 times.
         for (int j = 0; j < 10; ++j) {
-            sk_sp<GrDrawOp> batch(GrRandomDrawBatch(&random, context));
-            SkASSERT(batch);
+            sk_sp<GrDrawOp> op(GrRandomDrawBatch(&random, context));
+            SkASSERT(op);
             GrProcessorTestData ptd(&random, context, context->caps(),
                                     renderTargetContext.get(), dummyTextures);
             GrPaint grPaint;
@@ -376,8 +376,8 @@
                 BlockInputFragmentProcessor::Make(std::move(fp)));
             grPaint.addColorFragmentProcessor(std::move(blockFP));
 
-            renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone,
-                                                              batch.get());
+            renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+                                                              std::move(op));
             drawingManager->flush();
         }
     }
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 17ce369..63740b4 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -123,11 +123,11 @@
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
 #endif
-    sk_sp<GrDrawOp> batch;
+    sk_sp<GrDrawOp> op;
     GrPaint grPaint;
     // This one should succeed.
-    batch.reset(new Batch(attribCnt));
-    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, batch.get());
+    op.reset(new Batch(attribCnt));
+    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
@@ -135,8 +135,8 @@
 #endif
     context->resetGpuStats();
     // This one should fail.
-    batch.reset(new Batch(attribCnt+1));
-    renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, batch.get());
+    op.reset(new Batch(attribCnt+1));
+    renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
     context->flush();
 #if GR_GPU_STATS
     REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 574cb0c..a7feffc 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -243,16 +243,16 @@
     SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->fSingleOwner);)
 #define RETURN_IF_ABANDONED        if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; }
 
-void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint,
+void GrRenderTargetContextPriv::testingOnly_addDrawOp(const GrPaint& paint,
                                                       GrAAType aaType,
-                                                      GrDrawOp* batch,
+                                                      sk_sp<GrDrawOp> op,
                                                       const GrUserStencilSettings* uss,
                                                       bool snapToCenters) {
     ASSERT_SINGLE_OWNER
     RETURN_IF_ABANDONED
     SkDEBUGCODE(fRenderTargetContext->validate();)
     GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
-                              "GrRenderTargetContext::testingOnly_drawBatch");
+                              "GrRenderTargetContext::testingOnly_addDrawOp");
 
     GrPipelineBuilder pipelineBuilder(paint, aaType);
     if (uss) {
@@ -263,7 +263,7 @@
     }
 
     fRenderTargetContext->getOpList()->addDrawOp(pipelineBuilder, fRenderTargetContext, GrNoClip(),
-                                                 sk_ref_sp(batch));
+                                                 op);
 }
 
 #undef ASSERT_SINGLE_OWNER