Move test code out of header into CPP file.

This test code is templated, but not really generic (it's only meant to
work with two specific classes) so it doesn't need to live in a header.

Change-Id: I38d4f2cc9637207eca678fc81ff35ebbd7e69fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303656
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrProcessorUnitTest.h b/src/gpu/GrProcessorUnitTest.h
index d39afcd..341acaf 100644
--- a/src/gpu/GrProcessorUnitTest.h
+++ b/src/gpu/GrProcessorUnitTest.h
@@ -87,42 +87,23 @@
 public:
     using MakeProc = ProcessorSmartPtr (*)(GrProcessorTestData*);
 
-    GrProcessorTestFactory(MakeProc makeProc) {
-        fMakeProc = makeProc;
-        GetFactories()->push_back(this);
-    }
+    GrProcessorTestFactory(MakeProc makeProc);
 
     /** Pick a random factory function and create a processor.  */
-    static ProcessorSmartPtr Make(GrProcessorTestData* data) {
-        VerifyFactoryCount();
-        if (GetFactories()->count() == 0) {
-            return nullptr;
-        }
-        uint32_t idx = data->fRandom->nextRangeU(0, GetFactories()->count() - 1);
-        return MakeIdx(idx, data);
-    }
-
-    /** Number of registered factory functions */
-    static int Count() { return GetFactories()->count(); }
+    static ProcessorSmartPtr Make(GrProcessorTestData* data);
 
     /** Use factory function at Index idx to create a processor. */
-    static ProcessorSmartPtr MakeIdx(int idx, GrProcessorTestData* data) {
-        SkASSERT(idx < GetFactories()->count());
-        GrProcessorTestFactory<ProcessorSmartPtr>* factory = (*GetFactories())[idx];
-        ProcessorSmartPtr processor = factory->fMakeProc(data);
-        SkASSERT(processor);
-        return processor;
-    }
+    static ProcessorSmartPtr MakeIdx(int idx, GrProcessorTestData* data);
+
+    /** Number of registered factory functions */
+    static int Count();
 
 private:
-    /**
-     * A test function which verifies the count of factories.
-     */
+    /** A test function which verifies the count of factories. */
     static void VerifyFactoryCount();
+    static SkTArray<GrProcessorTestFactory<ProcessorSmartPtr>*, true>* GetFactories();
 
     MakeProc fMakeProc;
-
-    static SkTArray<GrProcessorTestFactory<ProcessorSmartPtr>*, true>* GetFactories();
 };
 
 using GrFragmentProcessorTestFactory = GrProcessorTestFactory<std::unique_ptr<GrFragmentProcessor>>;
@@ -132,24 +113,16 @@
 public:
     using GetFn = const GrXPFactory*(GrProcessorTestData*);
 
-    GrXPFactoryTestFactory(GetFn* getProc) : fGetProc(getProc) { GetFactories()->push_back(this); }
+    GrXPFactoryTestFactory(GetFn* getProc);
 
-    static const GrXPFactory* Get(GrProcessorTestData* data) {
-        VerifyFactoryCount();
-        if (GetFactories()->count() == 0) {
-            return nullptr;
-        }
-        uint32_t idx = data->fRandom->nextRangeU(0, GetFactories()->count() - 1);
-        const GrXPFactory* xpf = (*GetFactories())[idx]->fGetProc(data);
-        SkASSERT(xpf);
-        return xpf;
-    }
+    static const GrXPFactory* Get(GrProcessorTestData* data);
 
 private:
+    /** A test function which verifies the count of factories. */
     static void VerifyFactoryCount();
+    static SkTArray<GrXPFactoryTestFactory*, true>* GetFactories();
 
     GetFn* fGetProc;
-    static SkTArray<GrXPFactoryTestFactory*, true>* GetFactories();
 };
 
 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS