Add scratch-only version of performDeferredCleanup
Change-Id: I5707d1da1b69ab1ffaa77d7a391a187ac3e8eba1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417267
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 3a2ae7e..36b5c52 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -193,7 +193,7 @@
this->drawingManager()->freeGpuResources();
- fResourceCache->purgeAllUnlocked();
+ fResourceCache->purgeUnlockedResources();
}
bool GrDirectContext::init() {
@@ -317,7 +317,8 @@
fGpu->releaseUnlockedBackendObjects();
}
-void GrDirectContext::performDeferredCleanup(std::chrono::milliseconds msNotUsed) {
+void GrDirectContext::performDeferredCleanup(std::chrono::milliseconds msNotUsed,
+ bool scratchResourcesOnly) {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
ASSERT_SINGLE_OWNER
@@ -331,7 +332,7 @@
auto purgeTime = GrStdSteadyClock::now() - msNotUsed;
fResourceCache->purgeAsNeeded();
- fResourceCache->purgeResourcesNotUsedSince(purgeTime);
+ fResourceCache->purgeResourcesNotUsedSince(purgeTime, scratchResourcesOnly);
// The textBlob Cache doesn't actually hold any GPU resource but this is a convenient
// place to purge stale blobs