blob: c53fcb0492145e48a37faa6128d46ec9273d8dba [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() {
Florin Malitac337c9e2017-03-10 18:02:29 +000011 SkDEBUGCODE(this->freeAll();)
joshualittb7133be2015-04-08 09:08:31 -070012}
13
joshualitt26ffc002015-04-16 11:24:04 -070014void GrTextBlobCache::freeAll() {
Florin Malita33fdb8d2017-03-07 16:51:57 -050015 fBlobIDCache.foreach([this](uint32_t, BlobIDCacheEntry* entry) {
Florin Malitac337c9e2017-03-10 18:02:29 +000016 for (const auto& blob : entry->fBlobs) {
17 fBlobList.remove(blob.get());
Florin Malita33fdb8d2017-03-07 16:51:57 -050018 }
19 });
20
21 fBlobIDCache.reset();
joshualitt20ccd402016-01-05 08:56:56 -080022
23 // There should be no allocations in the memory pool at this point
24 SkASSERT(fPool.isEmpty());
Florin Malita33fdb8d2017-03-07 16:51:57 -050025 SkASSERT(fBlobList.isEmpty());
joshualitt26ffc002015-04-16 11:24:04 -070026}