[webkit-reviews] review granted: [Bug 234054] Use thread safe initialization for statics in ComplexTextController::collectComplexTextRunsForCharacters : [Attachment 446474] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 8 19:03:50 PST 2021
Darin Adler <darin at apple.com> has granted Cameron McCormack (:heycam)
<heycam at apple.com>'s request for review:
Bug 234054: Use thread safe initialization for statics in
ComplexTextController::collectComplexTextRunsForCharacters
https://bugs.webkit.org/show_bug.cgi?id=234054
Attachment 446474: Patch
https://bugs.webkit.org/attachment.cgi?id=446474&action=review
--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 446474
--> https://bugs.webkit.org/attachment.cgi?id=446474
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=446474&action=review
> Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:163
> +static CFDictionaryRef ltrTypesetterOptions()
> +{
> + static LazyNeverDestroyed<RetainPtr<CFDictionaryRef>> options;
> + static std::once_flag onceFlag;
> + std::call_once(onceFlag, [&] {
> + options.construct(makeTypesetterOptions(true));
> + });
> + return options.get().get();
> +}
> +
> +static CFDictionaryRef rtlTypesetterOptions()
> +{
> + static LazyNeverDestroyed<RetainPtr<CFDictionaryRef>> options;
> + static std::once_flag onceFlag;
> + std::call_once(onceFlag, [&] {
> + options.construct(makeTypesetterOptions(false));
> + });
> + return options.get().get();
> +}
Use a template function with an int or bool argument so we don’t have to repeat
the code twice?
> Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:205
> + RetainPtr<CTTypesetterRef> typesetter =
adoptCF(CTTypesetterCreateWithUniCharProviderAndOptions(&provideStringAndAttrib
utes, 0, &info, m_run.ltr() ? ltrTypesetterOptions() :
rtlTypesetterOptions()));
auto is better here
More information about the webkit-reviews
mailing list