| Summary: | Use thread safe initialization for statics in ComplexTextController::collectComplexTextRunsForCharacters | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Cameron McCormack (:heycam) <heycam> | ||||||
| Component: | Layout and Rendering | Assignee: | Cameron McCormack (:heycam) <heycam> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | bfulgham, darin, mattwoodrow, mmaxfield, simon.fraser, webkit-bug-importer, zalan | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Local Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=234102 | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 233488, 273109 | ||||||||
| Attachments: |
|
||||||||
|
Description
Cameron McCormack (:heycam)
2021-12-08 18:27:41 PST
Created attachment 446474 [details]
Patch
Comment on attachment 446474 [details] 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(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions() : rtlTypesetterOptions())); auto is better here This patch too won't be needed if bug 234102 succeeds. Created attachment 461057 [details]
Patch
Committed 252669@main (01711aa5bc47): <https://commits.webkit.org/252669@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 461057 [details]. |