Extended Color: Switch ColorMac.mm's nsColor() function over to using TinyLRUCache
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2020 14:13:33 +0000 (14:13 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2020 14:13:33 +0000 (14:13 +0000)
commit545e2f50a871cd5d2b7487cd371399c4735de754
tree08f59dca61d4f067e429ff3088093e879142e79f
parent102a24c58d8445abec86de5a49ec20bddcfa5ba9
Extended Color: Switch ColorMac.mm's nsColor() function over to using TinyLRUCache
https://bugs.webkit.org/show_bug.cgi?id=212918

Reviewed by Darin Adler.

* platform/graphics/Color.h:
(WebCore::Color::isExtended const):
Make asSimple() public, so nsColor() can use it. This also allows us to unfriend cachedCGColor().

* platform/graphics/mac/ColorMac.mm:
(WTF::RetainPtr<NSColor>>::createValueForKey):
(WebCore::nsColor):
Mimic the structure of cachedCGColor() by switching over simpleColor values for common
colors and using a 32 value TinyLRUCache for the rest.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/platform/graphics/Color.h
Source/WebCore/platform/graphics/cg/ColorCG.cpp
Source/WebCore/platform/graphics/mac/ColorMac.mm