Improve GrResourceAllocator test infrastructure

Adding new tests in an upcoming CL. This sets the stage for that.

I also outlined the Register ctor so that the diff in the next CL is
more readable.

Bug: skia:10877
Change-Id: I604f1ce811cddf1d1105716f114e27ce12bf8249
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394998
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index 9efdebf..5106a88 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -100,6 +100,16 @@
     fIntvlHash.set(proxyID, newIntvl);
 }
 
+GrResourceAllocator::Register::Register(GrSurfaceProxy* originatingProxy,
+                                        GrScratchKey scratchKey)
+        : fOriginatingProxy(originatingProxy)
+        , fScratchKey(std::move(scratchKey)) {
+    SkASSERT(originatingProxy);
+    SkASSERT(!originatingProxy->isInstantiated());
+    SkASSERT(!originatingProxy->isLazy());
+    SkDEBUGCODE(fUniqueID = CreateUniqueID();)
+}
+
 bool GrResourceAllocator::Register::isRecyclable(const GrCaps& caps,
                                                  GrSurfaceProxy* proxy,
                                                  int knownUseCount) const {
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index 6bc5a3b..fc06264 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -133,15 +133,7 @@
     class Register {
     public:
         // It's OK to pass an invalid scratch key iff the proxy has a unique key.
-        Register(GrSurfaceProxy* originatingProxy, GrScratchKey scratchKey)
-                : fOriginatingProxy(originatingProxy)
-                , fScratchKey(std::move(scratchKey)) {
-            SkASSERT(originatingProxy);
-            SkASSERT(!originatingProxy->isInstantiated());
-            SkASSERT(!originatingProxy->isLazy());
-            SkASSERT(this->scratchKey().isValid() ^ this->uniqueKey().isValid());
-            SkDEBUGCODE(fUniqueID = CreateUniqueID();)
-        }
+        Register(GrSurfaceProxy* originatingProxy, GrScratchKey);
 
         const GrScratchKey& scratchKey() const { return fScratchKey; }
         const GrUniqueKey& uniqueKey() const { return fOriginatingProxy->getUniqueKey(); }