[webkit-reviews] review granted: [Bug 223033] cachedCGColor() is not thread-safe : [Attachment 426482] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 19 15:45:21 PDT 2021


Darin Adler <darin at apple.com> has granted Said Abou-Hallawa
<sabouhallawa at apple.com>'s request for review:
Bug 223033: cachedCGColor() is not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=223033

Attachment 426482: Patch

https://bugs.webkit.org/attachment.cgi?id=426482&action=review




--- Comment #22 from Darin Adler <darin at apple.com> ---
Comment on attachment 426482
  --> https://bugs.webkit.org/attachment.cgi?id=426482
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426482&action=review

What about the NSColor method?

> Source/WebCore/platform/graphics/cg/ColorCG.cpp:134
> +	       std::call_once(onceFlag, [&color] {
> +		   transparentCGColor.construct(createCGColor(color));
> +	       });

We don’t really need to capture color here. Could write this instead:

    std::call(onceFlag, [] {
	transparentCGColor.construct(createCGColor(Color::transparentBlack));
    });

> Source/WebCore/platform/graphics/cg/ColorCG.cpp:142
> +	       std::call_once(onceFlag, [&color] {
> +		   blackCGColor.construct(createCGColor(color));
> +	       });

Ditto.

> Source/WebCore/platform/graphics/cg/ColorCG.cpp:150
> +	       std::call_once(onceFlag, [&color] {
> +		   whiteCGColor.construct(createCGColor(color));
> +	       });

Ditto.


More information about the webkit-reviews mailing list