joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 10 | GrTextBlobCache::~GrTextBlobCache() { |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 11 | this->freeAll(); |
joshualitt | b7133be | 2015-04-08 09:08:31 -0700 | [diff] [blame] | 12 | } |
| 13 | |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 14 | void GrTextBlobCache::freeAll() { |
joshualitt | 374b2f7 | 2015-07-21 08:05:03 -0700 | [diff] [blame] | 15 | SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key>::Iter iter(&fCache); |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 16 | while (!iter.done()) { |
joshualitt | 374b2f7 | 2015-07-21 08:05:03 -0700 | [diff] [blame] | 17 | GrAtlasTextBlob* blob = &(*iter); |
joshualitt | 7a9c45c | 2015-05-26 12:32:23 -0700 | [diff] [blame] | 18 | fBlobList.remove(blob); |
| 19 | blob->unref(); |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 20 | ++iter; |
| 21 | } |
| 22 | fCache.rewind(); |
joshualitt | 20ccd40 | 2016-01-05 08:56:56 -0800 | [diff] [blame] | 23 | |
| 24 | // There should be no allocations in the memory pool at this point |
| 25 | SkASSERT(fPool.isEmpty()); |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 26 | } |