No longer ref count GrGeometryProcessors

This CL is 100% plumbing. We ultimately want all GrPrimitiveProcessor-derived objects to not be refCounted. This will make several helper objects POD and, by putting them into an arena, will make managing their lifetime easier (e.g., for DDL prePreparing).

Note: the CCPR GrGeometryProcessor-derived classes only ever appear on the stack so aren't forced into arenas.

Bug: skia:9455
Change-Id: Ib9be503d2fbf8c2578642df93fc301156629829d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255304
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 02fc02b..f536e8e 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -57,24 +57,10 @@
     void onPrepareDraws(Target* target) override {
         class GP : public GrGeometryProcessor {
         public:
-            GP(int numAttribs) : INHERITED(kGP_ClassID), fNumAttribs(numAttribs) {
-                SkASSERT(numAttribs > 1);
-                fAttribNames.reset(new SkString[numAttribs]);
-                fAttributes.reset(new Attribute[numAttribs]);
-                for (auto i = 0; i < numAttribs; ++i) {
-                    fAttribNames[i].printf("attr%d", i);
-                    // This gives us more of a mix of attribute types, and allows the
-                    // component count to fit within the limits for iOS Metal.
-                    if (i & 0x1) {
-                        fAttributes[i] = {fAttribNames[i].c_str(), kFloat_GrVertexAttribType,
-                                                                   kFloat_GrSLType};
-                    } else {
-                        fAttributes[i] = {fAttribNames[i].c_str(), kFloat2_GrVertexAttribType,
-                                                                   kFloat2_GrSLType};
-                    }
-                }
-                this->setVertexAttributes(fAttributes.get(), numAttribs);
+            static GrGeometryProcessor* Make(SkArenaAlloc* arena, int numAttribs) {
+                return arena->make<GP>(numAttribs);
             }
+
             const char* name() const override { return "Dummy GP"; }
 
             GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override {
@@ -101,18 +87,40 @@
             }
 
         private:
+            friend class ::SkArenaAlloc; // for access to ctor
+
+            GP(int numAttribs) : INHERITED(kGP_ClassID), fNumAttribs(numAttribs) {
+                SkASSERT(numAttribs > 1);
+                fAttribNames.reset(new SkString[numAttribs]);
+                fAttributes.reset(new Attribute[numAttribs]);
+                for (auto i = 0; i < numAttribs; ++i) {
+                    fAttribNames[i].printf("attr%d", i);
+                    // This gives us more of a mix of attribute types, and allows the
+                    // component count to fit within the limits for iOS Metal.
+                    if (i & 0x1) {
+                        fAttributes[i] = {fAttribNames[i].c_str(), kFloat_GrVertexAttribType,
+                                                                   kFloat_GrSLType};
+                    } else {
+                        fAttributes[i] = {fAttribNames[i].c_str(), kFloat2_GrVertexAttribType,
+                                                                   kFloat2_GrSLType};
+                    }
+                }
+                this->setVertexAttributes(fAttributes.get(), numAttribs);
+            }
+
             int fNumAttribs;
             std::unique_ptr<SkString[]> fAttribNames;
             std::unique_ptr<Attribute[]> fAttributes;
 
             typedef GrGeometryProcessor INHERITED;
         };
-        sk_sp<GrGeometryProcessor> gp(new GP(fNumAttribs));
+
+        GrGeometryProcessor* gp = GP::Make(target->allocator(), fNumAttribs);
         size_t vertexStride = gp->vertexStride();
         QuadHelper helper(target, vertexStride, 1);
         SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.vertices());
         SkPointPriv::SetRectTriStrip(vertices, 0.f, 0.f, 1.f, 1.f, vertexStride);
-        helper.recordDraw(target, std::move(gp));
+        helper.recordDraw(target, gp);
     }
 
     void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {