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 {