add textblob cache freeall
BUG=skia:
Review URL: https://codereview.chromium.org/1088683004
diff --git a/src/gpu/GrTextBlobCache.cpp b/src/gpu/GrTextBlobCache.cpp
index fe0ccf6..d32e24b 100644
--- a/src/gpu/GrTextBlobCache.cpp
+++ b/src/gpu/GrTextBlobCache.cpp
@@ -10,11 +10,7 @@
static const int kVerticesPerGlyph = 4;
GrTextBlobCache::~GrTextBlobCache() {
- SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key>::Iter iter(&fCache);
- while (!iter.done()) {
- (&(*iter))->unref();
- ++iter;
- }
+ this->freeAll();
}
GrAtlasTextContext::BitmapTextBlob* GrTextBlobCache::createBlob(int glyphCount, int runCount,
@@ -48,3 +44,12 @@
#endif
return cacheBlob;
}
+
+void GrTextBlobCache::freeAll() {
+ SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key>::Iter iter(&fCache);
+ while (!iter.done()) {
+ (&(*iter))->unref();
+ ++iter;
+ }
+ fCache.rewind();
+}