Title: [187568] trunk/Source/WebCore
Revision
187568
Author
mmaxfi...@apple.com
Date
2015-07-29 16:38:29 -0700 (Wed, 29 Jul 2015)

Log Message

Rename FontDescriptionFontDataCacheKey to FontDescriptionKey
https://bugs.webkit.org/show_bug.cgi?id=147424

Reviewed by Simon Fraser.

This struct holds information about a FontDescription.

No new tests because there is no behavior change.

* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges):
* platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKeyHash::hash):
(WebCore::computeHash): Deleted.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator==):
(WebCore::FontDescriptionKey::operator!=):
(WebCore::FontDescriptionKey::computeHash):
(WebCore::FontDescriptionFontDataCacheKey::FontDescriptionFontDataCacheKey): Deleted.
(WebCore::FontDescriptionFontDataCacheKey::operator==): Deleted.
(WebCore::FontDescriptionFontDataCacheKey::operator!=): Deleted.
(WebCore::FontDescriptionFontDataCacheKey::computeHash): Deleted.
* platform/graphics/FontCascade.cpp:
(WebCore::operator==):
(WebCore::makeFontCascadeCacheKey):
(WebCore::computeFontCascadeCacheHash):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187567 => 187568)


--- trunk/Source/WebCore/ChangeLog	2015-07-29 23:29:12 UTC (rev 187567)
+++ trunk/Source/WebCore/ChangeLog	2015-07-29 23:38:29 UTC (rev 187568)
@@ -1,3 +1,33 @@
+2015-07-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Rename FontDescriptionFontDataCacheKey to FontDescriptionKey
+        https://bugs.webkit.org/show_bug.cgi?id=147424
+
+        Reviewed by Simon Fraser.
+
+        This struct holds information about a FontDescription.
+
+        No new tests because there is no behavior change.
+
+        * css/CSSSegmentedFontFace.cpp:
+        (WebCore::CSSSegmentedFontFace::fontRanges):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontPlatformDataCacheKeyHash::hash):
+        (WebCore::computeHash): Deleted.
+        * platform/graphics/FontCache.h:
+        (WebCore::FontDescriptionKey::FontDescriptionKey):
+        (WebCore::FontDescriptionKey::operator==):
+        (WebCore::FontDescriptionKey::operator!=):
+        (WebCore::FontDescriptionKey::computeHash):
+        (WebCore::FontDescriptionFontDataCacheKey::FontDescriptionFontDataCacheKey): Deleted.
+        (WebCore::FontDescriptionFontDataCacheKey::operator==): Deleted.
+        (WebCore::FontDescriptionFontDataCacheKey::operator!=): Deleted.
+        (WebCore::FontDescriptionFontDataCacheKey::computeHash): Deleted.
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::operator==):
+        (WebCore::makeFontCascadeCacheKey):
+        (WebCore::computeFontCascadeCacheHash):
+
 2015-07-29  Zalan Bujtas  <za...@apple.com>
 
         Remove the spanner placeholder from m_spannerMap when the placeholder object

Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp (187567 => 187568)


--- trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2015-07-29 23:29:12 UTC (rev 187567)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2015-07-29 23:38:29 UTC (rev 187568)
@@ -113,7 +113,7 @@
         return FontRanges();
 
     FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
-    // FIXME: Unify this function with FontDescriptionFontDataCacheKey in FontCache.h (Or just use the regular FontCache instead of this)
+    // FIXME: Unify this function with FontDescriptionKey in FontCache.h (Or just use the regular FontCache instead of this)
     unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + FontSynthesisWidth + 1))
         | (fontDescription.fontSynthesis() << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
         | ((fontDescription.orientation() == Vertical ? 1 : 0) << (FontTraitsMaskWidth + FontWidthVariantWidth))

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (187567 => 187568)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2015-07-29 23:29:12 UTC (rev 187567)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2015-07-29 23:38:29 UTC (rev 187568)
@@ -113,22 +113,17 @@
         return equalIgnoringCase(m_family, other.m_family) && m_fontDescriptionKey == other.m_fontDescriptionKey;
     }
 
-    FontDescriptionFontDataCacheKey m_fontDescriptionKey;
+    FontDescriptionKey m_fontDescriptionKey;
     AtomicString m_family;
 
 private:
     static unsigned hashTableDeletedSize() { return 0xFFFFFFFFU; }
 };
 
-inline unsigned computeHash(const FontPlatformDataCacheKey& fontKey)
-{
-    return pairIntHash(CaseFoldingHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash());
-}
-
 struct FontPlatformDataCacheKeyHash {
-    static unsigned hash(const FontPlatformDataCacheKey& font)
+    static unsigned hash(const FontPlatformDataCacheKey& fontKey)
     {
-        return computeHash(font);
+        return pairIntHash(CaseFoldingHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash());
     }
          
     static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b)
@@ -139,10 +134,8 @@
     static const bool safeToCompareToEmptyOrDeleted = true;
 };
 
-struct FontPlatformDataCacheKeyTraits : WTF::SimpleClassHashTraits<FontPlatformDataCacheKey> { };
+typedef HashMap<FontPlatformDataCacheKey, std::unique_ptr<FontPlatformData>, FontPlatformDataCacheKeyHash, WTF::SimpleClassHashTraits<FontPlatformDataCacheKey>> FontPlatformDataCache;
 
-typedef HashMap<FontPlatformDataCacheKey, std::unique_ptr<FontPlatformData>, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache;
-
 static FontPlatformDataCache& fontPlatformDataCache()
 {
     static NeverDestroyed<FontPlatformDataCache> cache;

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (187567 => 187568)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2015-07-29 23:29:12 UTC (rev 187567)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2015-07-29 23:38:29 UTC (rev 187568)
@@ -66,13 +66,13 @@
 #endif
 
 // This key contains the FontDescription fields other than family that matter when fetching FontDatas (platform fonts).
-struct FontDescriptionFontDataCacheKey {
-    explicit FontDescriptionFontDataCacheKey(unsigned size = 0)
+struct FontDescriptionKey {
+    explicit FontDescriptionKey(unsigned size = 0)
         : size(size)
         , weight(0)
         , flags(0)
     { }
-    FontDescriptionFontDataCacheKey(const FontDescription& description)
+    FontDescriptionKey(const FontDescription& description)
         : size(description.computedPixelSize())
         , weight(description.weight())
         , flags(makeFlagKey(description))
@@ -86,17 +86,17 @@
             | static_cast<unsigned>(description.italic()) << 1
             | static_cast<unsigned>(description.renderingMode());
     }
-    bool operator==(const FontDescriptionFontDataCacheKey& other) const
+    bool operator==(const FontDescriptionKey& other) const
     {
         return size == other.size && weight == other.weight && flags == other.flags;
     }
-    bool operator!=(const FontDescriptionFontDataCacheKey& other) const
+    bool operator!=(const FontDescriptionKey& other) const
     {
         return !(*this == other);
     }
     inline unsigned computeHash() const
     {
-        return StringHasher::hashMemory<sizeof(FontDescriptionFontDataCacheKey)>(this);
+        return StringHasher::hashMemory<sizeof(FontDescriptionKey)>(this);
     }
     unsigned size;
     unsigned weight;

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (187567 => 187568)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-07-29 23:29:12 UTC (rev 187567)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-07-29 23:38:29 UTC (rev 187568)
@@ -196,7 +196,7 @@
 
 struct FontCascadeCacheKey {
     // This part of the key is shared with the lower level FontCache (caching FontData objects).
-    FontDescriptionFontDataCacheKey fontDescriptionCacheKey;
+    FontDescriptionKey fontDescriptionKey;
     Vector<AtomicString, 3> families;
     unsigned fontSelectorId;
     unsigned fontSelectorVersion;
@@ -218,7 +218,7 @@
 
 static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)
 {
-    if (a.fontDescriptionCacheKey != b.fontDescriptionCacheKey)
+    if (a.fontDescriptionKey != b.fontDescriptionKey)
         return false;
     if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion || a.fontSelectorFlags != b.fontSelectorFlags)
         return false;
@@ -256,7 +256,7 @@
 static FontCascadeCacheKey makeFontCascadeCacheKey(const FontDescription& description, FontSelector* fontSelector)
 {
     FontCascadeCacheKey key;
-    key.fontDescriptionCacheKey = FontDescriptionFontDataCacheKey(description);
+    key.fontDescriptionKey = FontDescriptionKey(description);
     for (unsigned i = 0; i < description.familyCount(); ++i)
         key.families.append(description.familyAt(i));
     key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0;
@@ -270,7 +270,7 @@
     Vector<unsigned, 7> hashCodes;
     hashCodes.reserveInitialCapacity(4 + key.families.size());
 
-    hashCodes.uncheckedAppend(key.fontDescriptionCacheKey.computeHash());
+    hashCodes.uncheckedAppend(key.fontDescriptionKey.computeHash());
     hashCodes.uncheckedAppend(key.fontSelectorId);
     hashCodes.uncheckedAppend(key.fontSelectorVersion);
     hashCodes.uncheckedAppend(key.fontSelectorFlags);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to