blob: ce74977e49fa1b65628706f216acf8a337b2a9a3 [file] [log] [blame]
joshualittb7133be2015-04-08 09:08:31 -07001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrTextBlobCache.h"
9
joshualittb7133be2015-04-08 09:08:31 -070010GrTextBlobCache::~GrTextBlobCache() {
joshualitt26ffc002015-04-16 11:24:04 -070011 this->freeAll();
joshualittb7133be2015-04-08 09:08:31 -070012}
13
joshualitt26ffc002015-04-16 11:24:04 -070014void GrTextBlobCache::freeAll() {
joshualitt374b2f72015-07-21 08:05:03 -070015 SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key>::Iter iter(&fCache);
joshualitt26ffc002015-04-16 11:24:04 -070016 while (!iter.done()) {
joshualitt374b2f72015-07-21 08:05:03 -070017 GrAtlasTextBlob* blob = &(*iter);
joshualitt7a9c45c2015-05-26 12:32:23 -070018 fBlobList.remove(blob);
19 blob->unref();
joshualitt26ffc002015-04-16 11:24:04 -070020 ++iter;
21 }
22 fCache.rewind();
joshualitt20ccd402016-01-05 08:56:56 -080023
24 // There should be no allocations in the memory pool at this point
25 SkASSERT(fPool.isEmpty());
joshualitt26ffc002015-04-16 11:24:04 -070026}