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]++;