Add `reportLeaks` method to GrMemoryPool.
This doesn't change any behavior; it just exposes existing code that
previously could only run at ~GrMemoryPool time. Now you can report
leaks on a memory pool without actually destroying it.
Change-Id: I35bf6c7d886827031cce0e2b045775207062c121
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330217
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index b580531..2686cbf 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -34,6 +34,12 @@
}
GrMemoryPool::~GrMemoryPool() {
+ this->reportLeaks();
+ SkASSERT(0 == fAllocationCount);
+ SkASSERT(this->isEmpty());
+}
+
+void GrMemoryPool::reportLeaks() const {
#ifdef SK_DEBUG
int i = 0;
int n = fAllocatedIDs.count();
@@ -47,8 +53,6 @@
}
});
#endif
- SkASSERT(0 == fAllocationCount);
- SkASSERT(this->isEmpty());
}
void* GrMemoryPool::allocate(size_t size) {