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() { |
Florin Malita | c337c9e | 2017-03-10 18:02:29 +0000 | [diff] [blame^] | 11 | SkDEBUGCODE(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() { |
Florin Malita | 33fdb8d | 2017-03-07 16:51:57 -0500 | [diff] [blame] | 15 | fBlobIDCache.foreach([this](uint32_t, BlobIDCacheEntry* entry) { |
Florin Malita | c337c9e | 2017-03-10 18:02:29 +0000 | [diff] [blame^] | 16 | for (const auto& blob : entry->fBlobs) { |
| 17 | fBlobList.remove(blob.get()); |
Florin Malita | 33fdb8d | 2017-03-07 16:51:57 -0500 | [diff] [blame] | 18 | } |
| 19 | }); |
| 20 | |
| 21 | fBlobIDCache.reset(); |
joshualitt | 20ccd40 | 2016-01-05 08:56:56 -0800 | [diff] [blame] | 22 | |
| 23 | // There should be no allocations in the memory pool at this point |
| 24 | SkASSERT(fPool.isEmpty()); |
Florin Malita | 33fdb8d | 2017-03-07 16:51:57 -0500 | [diff] [blame] | 25 | SkASSERT(fBlobList.isEmpty()); |
joshualitt | 26ffc00 | 2015-04-16 11:24:04 -0700 | [diff] [blame] | 26 | } |