From e5ed50b2c86063f8b37a55bc829b2c4fa07bc8d5 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Wed, 3 Feb 2021 14:29:54 -0500 Subject: [PATCH] notify type size for SkGlyphScaler_remote Add type size so we can check that the UWA failures are happening on the size boundaries between direct and SDF, and SDF small to SDF medium. Bug=skia:11241 Change-Id: I7d0823ab1fb4c9c8db13ba884a2b2454ba4bf210 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365636 Reviewed-by: Ben Wagner Commit-Queue: Herb Derby --- src/core/SkRemoteGlyphCache.h | 7 ++++++- src/core/SkTypeface_remote.cpp | 12 ++++++++---- tests/SkRemoteGlyphCacheTest.cpp | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/core/SkRemoteGlyphCache.h b/src/core/SkRemoteGlyphCache.h index 15840c3a49..3916e6e09e 100644 --- a/src/core/SkRemoteGlyphCache.h +++ b/src/core/SkRemoteGlyphCache.h @@ -130,7 +130,12 @@ public: // successful, subsequent attempts to delete the same handle are invalid. virtual bool deleteHandle(SkDiscardableHandleId) = 0; - virtual void notifyCacheMiss(CacheMissType) {} + // TODO: remove this old interface when Chrome has moved over to the one below. + virtual void notifyCacheMiss(CacheMissType type) { } + + virtual void notifyCacheMiss(CacheMissType type, int fontSize) { + this->notifyCacheMiss(type); + } struct ReadFailureData { size_t memorySize; diff --git a/src/core/SkTypeface_remote.cpp b/src/core/SkTypeface_remote.cpp index 285bb9ecf6..725f611eaa 100644 --- a/src/core/SkTypeface_remote.cpp +++ b/src/core/SkTypeface_remote.cpp @@ -31,7 +31,8 @@ void SkScalerContextProxy::generateMetrics(SkGlyph* glyph) { glyph->fMaskFormat = fRec.fMaskFormat; glyph->zeroMetrics(); - fDiscardableManager->notifyCacheMiss(SkStrikeClient::CacheMissType::kGlyphMetrics); + fDiscardableManager->notifyCacheMiss( + SkStrikeClient::CacheMissType::kGlyphMetrics, fRec.fTextSize); } void SkScalerContextProxy::generateImage(const SkGlyph& glyph) { @@ -42,7 +43,8 @@ void SkScalerContextProxy::generateImage(const SkGlyph& glyph) { // There is no desperation search here, because if there was an image to be found it was // copied over with the metrics search. - fDiscardableManager->notifyCacheMiss(SkStrikeClient::CacheMissType::kGlyphImage); + fDiscardableManager->notifyCacheMiss( + SkStrikeClient::CacheMissType::kGlyphImage, fRec.fTextSize); } bool SkScalerContextProxy::generatePath(SkGlyphID glyphID, SkPath* path) { @@ -51,7 +53,8 @@ bool SkScalerContextProxy::generatePath(SkGlyphID glyphID, SkPath* path) { SkDebugf("GlyphCacheMiss generatePath: %s\n", this->getRec().dump().c_str()); } - fDiscardableManager->notifyCacheMiss(SkStrikeClient::CacheMissType::kGlyphPath); + fDiscardableManager->notifyCacheMiss( + SkStrikeClient::CacheMissType::kGlyphPath, fRec.fTextSize); return false; } @@ -64,7 +67,8 @@ void SkScalerContextProxy::generateFontMetrics(SkFontMetrics* metrics) { } // Font metrics aren't really used for render, so just zero out the data and return. - fDiscardableManager->notifyCacheMiss(SkStrikeClient::CacheMissType::kFontMetrics); + fDiscardableManager->notifyCacheMiss( + SkStrikeClient::CacheMissType::kFontMetrics, fRec.fTextSize); sk_bzero(metrics, sizeof(*metrics)); } diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp index c173328a89..07608f617a 100644 --- a/tests/SkRemoteGlyphCacheTest.cpp +++ b/tests/SkRemoteGlyphCacheTest.cpp @@ -55,7 +55,7 @@ public: return id <= fLastDeletedHandleId; } - void notifyCacheMiss(SkStrikeClient::CacheMissType type) override { + void notifyCacheMiss(SkStrikeClient::CacheMissType type, int fontSize) override { SkAutoMutexExclusive l(fMutex); fCacheMissCount[type]++;