aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-06-21 14:06:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-21 19:22:27 +0000
commitc113e9e23d76a463743d6e5372284fb84b58fd8c (patch)
tree8aea78c4d940d63aa5e33582203468eeade2cee0 /src
parent09f92b94f55abcee37535da72e5bf7a51fa515d8 (diff)
Make SkStrikeCache::Validate call non global version
Change Validate to ValidateGlyphCacheDataSize. Make it call a non-global version. BUG=skia:8091 Change-Id: Iec31a06569a0ab1ec318e693e699a808eb9ad247 Reviewed-on: https://skia-review.googlesource.com/136638 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkStrikeCache.cpp22
-rw-r--r--src/core/SkStrikeCache.h9
2 files changed, 19 insertions, 12 deletions
diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp
index 817d00b2e3..bac48d8230 100644
--- a/src/core/SkStrikeCache.cpp
+++ b/src/core/SkStrikeCache.cpp
@@ -181,14 +181,6 @@ void SkStrikeCache::PurgeAll() {
GlobalStrikeCache()->purgeAll();
}
-void SkStrikeCache::Validate() {
-#ifdef SK_DEBUG
- auto visitor = [](const SkGlyphCache& cache) { cache.forceValidate(); };
-
- GlobalStrikeCache()->forEachStrike(visitor);
-#endif
-}
-
void SkStrikeCache::Dump() {
SkDebugf("GlyphCache [ used budget ]\n");
SkDebugf(" bytes [ %8zu %8zu ]\n",
@@ -559,6 +551,20 @@ void SkStrikeCache::internalDetachCache(Node* node) {
node->fPrev = node->fNext = nullptr;
}
+void SkStrikeCache::ValidateGlyphCacheDataSize() {
+#ifdef SK_DEBUG
+ GlobalStrikeCache()->validateGlyphCacheDataSize();
+#endif
+}
+
+#ifdef SK_DEBUG
+void SkStrikeCache::validateGlyphCacheDataSize() const {
+ this->forEachStrike(
+ [](const SkGlyphCache& cache) { cache.forceValidate();
+ });
+}
+#endif
+
#ifdef SK_DEBUG
void SkStrikeCache::validate() const {
size_t computedBytes = 0;
diff --git a/src/core/SkStrikeCache.h b/src/core/SkStrikeCache.h
index 7b600181d2..22f1daf9fb 100644
--- a/src/core/SkStrikeCache.h
+++ b/src/core/SkStrikeCache.h
@@ -121,7 +121,7 @@ public:
const SkDescriptor&, const SkScalerContextEffects&, const SkTypeface&);
static void PurgeAll();
- static void Validate();
+ static void ValidateGlyphCacheDataSize();
static void Dump();
// Dump memory usage statistics of all the attaches caches in the process using the
@@ -131,9 +131,6 @@ public:
// call when a glyphcache is available for caching (i.e. not in use)
void attachNode(Node* node);
-
-
-
void purgeAll(); // does not change budget
int getCacheCountLimit() const;
@@ -148,9 +145,13 @@ public:
int setCachePointSizeLimit(int limit);
#ifdef SK_DEBUG
+ // A simple accounting of what each glyph cache reports and the strike cache total.
void validate() const;
+ // Make sure that each glyph cache's memory tracking and actual memory used are in sync.
+ void validateGlyphCacheDataSize() const;
#else
void validate() const {}
+ void validateGlyphCacheDataSize() const {}
#endif
private: