diff options
author | 2017-03-13 16:45:28 -0400 | |
---|---|---|
committer | 2017-03-14 14:00:13 +0000 | |
commit | 4a01ac9e410e7b78fb04c8632e0676082b9408aa (patch) | |
tree | 6a834475439e681020026500b3c7f6c13cb7bfef /include | |
parent | b66b42f1749a7a23fd610d90605978537bf4fbb7 (diff) |
Purge GrTextBlobCache entries on SkTextBlob deletion
Similar to the SkImage purge mechanism.
Change-Id: I0b7fb1bad507a3c7f30a4f7514bedd894d1748ac
Reviewed-on: https://skia-review.googlesource.com/9631
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkTextBlob.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h index 1d17f4dafe..956c6a092d 100644 --- a/include/core/SkTextBlob.h +++ b/include/core/SkTextBlob.h @@ -9,6 +9,7 @@ #define SkTextBlob_DEFINED #include "../private/SkTemplates.h" +#include "../private/SkAtomics.h" #include "SkPaint.h" #include "SkString.h" #include "SkRefCnt.h" @@ -75,11 +76,19 @@ private: static unsigned ScalarsPerGlyph(GlyphPositioning pos); + // Call when this blob is part of the key to a cache entry. This allows the cache + // to know automatically those entries can be purged when this SkTextBlob is deleted. + void notifyAddedToCache() const { + fAddedToCache.store(true); + } + + friend class GrTextBlobCache; friend class SkTextBlobBuilder; friend class SkTextBlobRunIterator; - const SkRect fBounds; - const uint32_t fUniqueID; + const SkRect fBounds; + const uint32_t fUniqueID; + mutable SkAtomic<bool> fAddedToCache; SkDEBUGCODE(size_t fStorageSize;) |