Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: third_party/WebKit/Source/platform/fonts/FontDataCache.h

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/FontDataCache.h
diff --git a/third_party/WebKit/Source/platform/fonts/FontDataCache.h b/third_party/WebKit/Source/platform/fonts/FontDataCache.h
index 3652e0350b1479675a59fdeb504e315eeb6a056f..4f011113baedffcbabb352d9b536ffd7dfaaacaf 100644
--- a/third_party/WebKit/Source/platform/fonts/FontDataCache.h
+++ b/third_party/WebKit/Source/platform/fonts/FontDataCache.h
@@ -60,7 +60,7 @@ struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> {
static const bool emptyValueIsZero = true;
static const FontPlatformData& emptyValue()
{
- DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false));
+ DEFINE_STATIC_LOCAL(FontPlatformData, key, (false, false));
return key;
}
static void constructDeletedValue(FontPlatformData& slot, bool)
@@ -79,7 +79,7 @@ class FontDataCache {
public:
FontDataCache() { }
- PassRefPtr<SimpleFontData> get(const FontPlatformData*, ShouldRetain = Retain);
+ PassRefPtr<SimpleFontData> get(const FontPlatformData*, float fontSize, ShouldRetain = Retain);
bool contains(const FontPlatformData*) const;
void release(const SimpleFontData*);
@@ -94,7 +94,8 @@ public:
private:
bool purgeLeastRecentlyUsed(int count);
- typedef HashMap<FontPlatformData, std::pair<RefPtr<SimpleFontData>, unsigned>, FontDataCacheKeyHash, FontDataCacheKeyTraits> Cache;
+ typedef HashMap<float, std::pair<RefPtr<SimpleFontData>, unsigned>> InnerCache;
+ typedef HashMap<FontPlatformData, InnerCache, FontDataCacheKeyHash, FontDataCacheKeyTraits> Cache;
Cache m_cache;
ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData;
};

Powered by Google App Engine
This is Rietveld 408576698