Hold sk_sp<GrAtlasTextBlob> refs in GrTextBlobCache instead of raw ptrs
Refactor to store sk_sps, and minimize explicit ref manipulation.
Change-Id: Ie3d18e5fe1cefbbc5c2f3c4941287a24038522a6
Reviewed-on: https://skia-review.googlesource.com/9490
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/text/GrTextBlobCache.cpp b/src/gpu/text/GrTextBlobCache.cpp
index f6dac69..c53fcb0 100644
--- a/src/gpu/text/GrTextBlobCache.cpp
+++ b/src/gpu/text/GrTextBlobCache.cpp
@@ -8,14 +8,13 @@
#include "GrTextBlobCache.h"
GrTextBlobCache::~GrTextBlobCache() {
- this->freeAll();
+ SkDEBUGCODE(this->freeAll();)
}
void GrTextBlobCache::freeAll() {
fBlobIDCache.foreach([this](uint32_t, BlobIDCacheEntry* entry) {
- for (auto* blob : entry->fBlobs) {
- fBlobList.remove(blob);
- blob->unref();
+ for (const auto& blob : entry->fBlobs) {
+ fBlobList.remove(blob.get());
}
});