Title: [200140] trunk/Source/WebCore
Revision
200140
Author
[email protected]
Date
2016-04-27 12:00:38 -0700 (Wed, 27 Apr 2016)

Log Message

Remove unnecessary HashMap from Font
https://bugs.webkit.org/show_bug.cgi?id=157090

Reviewed by Darin Adler.

There were only ever a maximum of 2 keys in the hashmap.

No new tests because there is no behavior change.

* platform/graphics/Font.h:
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200139 => 200140)


--- trunk/Source/WebCore/ChangeLog	2016-04-27 19:00:22 UTC (rev 200139)
+++ trunk/Source/WebCore/ChangeLog	2016-04-27 19:00:38 UTC (rev 200140)
@@ -1,5 +1,20 @@
 2016-04-27  Myles C. Maxfield  <[email protected]>
 
+        Remove unnecessary HashMap from Font
+        https://bugs.webkit.org/show_bug.cgi?id=157090
+
+        Reviewed by Darin Adler.
+
+        There were only ever a maximum of 2 keys in the hashmap.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/Font.h:
+        * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+        (WebCore::Font::getCFStringAttributes):
+
+2016-04-27  Myles C. Maxfield  <[email protected]>
+
         Rename DerivedFontData to DerivedFonts
         https://bugs.webkit.org/show_bug.cgi?id=157092
 

Modified: trunk/Source/WebCore/platform/graphics/Font.h (200139 => 200140)


--- trunk/Source/WebCore/platform/graphics/Font.h	2016-04-27 19:00:22 UTC (rev 200139)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2016-04-27 19:00:38 UTC (rev 200140)
@@ -276,7 +276,8 @@
 #endif
 
 #if PLATFORM(COCOA)
-    mutable HashMap<unsigned, RetainPtr<CFDictionaryRef>> m_CFStringAttributes;
+    mutable RetainPtr<CFDictionaryRef> m_nonKernedCFStringAttributes;
+    mutable RetainPtr<CFDictionaryRef> m_kernedCFStringAttributes;
     mutable Optional<BitVector> m_glyphsSupportedBySmallCaps;
     mutable Optional<BitVector> m_glyphsSupportedByAllSmallCaps;
     mutable Optional<BitVector> m_glyphsSupportedByPetiteCaps;

Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (200139 => 200140)


--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2016-04-27 19:00:22 UTC (rev 200139)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2016-04-27 19:00:38 UTC (rev 200140)
@@ -37,10 +37,8 @@
 
 CFDictionaryRef Font::getCFStringAttributes(bool enableKerning, FontOrientation orientation) const
 {
-    unsigned key = static_cast<unsigned>(enableKerning) + 1;
-    HashMap<unsigned, RetainPtr<CFDictionaryRef>>::AddResult addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>());
-    RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.iterator->value;
-    if (!addResult.isNewEntry)
+    auto& attributesDictionary = enableKerning ? m_kernedCFStringAttributes : m_nonKernedCFStringAttributes;
+    if (attributesDictionary)
         return attributesDictionary.get();
 
     attributesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to