For non-ccpr draws make sure all inputs to GrGPUCommandBuffer are long lived.

This change makes sure that all inputs to GrGpuRenderTargetCommandBuffer::draw
to live and are valid throughout the entire execution of a given op list. This is
achieved by either having the objects live on the Op itself or allocated on the
flush states arena.

This is needed for a future change to easily allow us to switch between using vulkan
secondary and primary command buffer for executing draws. We will land this change
now to see if there are any significant perf hits for not using the stack for these
objects anymore.

This change does not handle CCPR allocations, but those will need to be handled if
this doesn't cause any problems and we move forward.

Change-Id: I7ae94a8c645f21771342bea5d03850d2a0a1fcf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233982
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp
index b816ecd..fc3bce4 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/GrFillRRectOp.cpp
@@ -738,8 +738,8 @@
         return;
     }
 
-    Processor proc(fAAType, fFlags);
-    SkASSERT(proc.instanceStride() == (size_t)fInstanceStride);
+    Processor* proc = flushState->allocator()->make<Processor>(fAAType, fFlags);
+    SkASSERT(proc->instanceStride() == (size_t)fInstanceStride);
 
     GrPipeline::InitArgs initArgs;
     if (GrAAType::kMSAA == fAAType) {
@@ -749,16 +749,19 @@
     initArgs.fDstProxy = flushState->drawOpArgs().fDstProxy;
     initArgs.fOutputSwizzle = flushState->drawOpArgs().fOutputSwizzle;
     auto clip = flushState->detachAppliedClip();
-    GrPipeline::FixedDynamicState fixedDynamicState(clip.scissorState().rect());
-    GrPipeline pipeline(initArgs, std::move(fProcessors), std::move(clip));
+    GrPipeline::FixedDynamicState* fixedDynamicState =
+        flushState->allocator()->make<GrPipeline::FixedDynamicState>(clip.scissorState().rect());
+    GrPipeline* pipeline = flushState->allocator()->make<GrPipeline>(initArgs,
+                                                                     std::move(fProcessors),
+                                                                     std::move(clip));
 
-    GrMesh mesh(GrPrimitiveType::kTriangles);
-    mesh.setIndexedInstanced(
+    GrMesh* mesh = flushState->allocator()->make<GrMesh>(GrPrimitiveType::kTriangles);
+    mesh->setIndexedInstanced(
             std::move(indexBuffer), indexCount, fInstanceBuffer, fInstanceCount, fBaseInstance,
             GrPrimitiveRestart::kNo);
-    mesh.setVertexData(std::move(vertexBuffer));
+    mesh->setVertexData(std::move(vertexBuffer));
     flushState->rtCommandBuffer()->draw(
-            proc, pipeline, &fixedDynamicState, nullptr, &mesh, 1, this->bounds());
+            *proc, *pipeline, fixedDynamicState, nullptr, mesh, 1, this->bounds());
 }
 
 // Will the given corner look good if we use HW derivatives?