[Cocoa] FontPlatformData objects aren't cached at all when using font-family:system-ui
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Apr 2019 00:51:04 +0000 (00:51 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Apr 2019 00:51:04 +0000 (00:51 +0000)
commit4166cdddf64e6bb542d1d778e775469c0f3238cc
tree7ffcf433225fd9b2ca548c9c72c12d34c21849f0
parent2b875b3aee6bd747fc5061be70364af28d2373f3
[Cocoa] FontPlatformData objects aren't cached at all when using font-family:system-ui
https://bugs.webkit.org/show_bug.cgi?id=196846
<rdar://problem/49499971>

Reviewed by Simon Fraser and Darin Adler.

PerformanceTests:

* Layout/system-ui-rebuild-emoji.html: Added.

Source/WebCore:

When adding the special codepath for system-ui to behave as an entire list of fonts rather than a single item,
I never added a cache for the FontPlatformData objects that codepath creates. The non-system-ui codepath already
has a cache in fontPlatformDataCache() in FontCache.cpp.

This patch causes a 16.8x performance improvement on the attached benchmark.

Test: PerformanceTests/Layout/system-ui-rebuild-emoji.html

* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::invalidateFontCache):
* platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
(WebCore::FontFamilySpecificationKey::FontFamilySpecificationKey):
(WebCore::FontFamilySpecificationKey::operator== const):
(WebCore::FontFamilySpecificationKey::operator!= const):
(WebCore::FontFamilySpecificationKey::isHashTableDeletedValue const):
(WebCore::FontFamilySpecificationKey::computeHash const):
(WebCore::FontFamilySpecificationKeyHash::hash):
(WebCore::FontFamilySpecificationKeyHash::equal):
(WebCore::fontMap):
(WebCore::clearFontFamilySpecificationCoreTextCache):
(WebCore::FontFamilySpecificationCoreText::fontRanges const):
* platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
(WebCore::safeCFEqual): Deleted.

Source/WTF:

* wtf/RetainPtr.h:
(WTF::safeCFEqual):
(WTF::safeCFHash):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PerformanceTests/ChangeLog
PerformanceTests/Layout/system-ui-rebuild-emoji.html [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/wtf/RetainPtr.h
Source/WebCore/ChangeLog
Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp
Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.h
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm