RESOLVED FIXED 239022
Update listMarkerTextForNodeAndPosition() to return a StringView instead of a String
https://bugs.webkit.org/show_bug.cgi?id=239022
Summary Update listMarkerTextForNodeAndPosition() to return a StringView instead of a...
Chris Dumez
Reported 2022-04-08 17:09:32 PDT
Update listMarkerTextForNodeAndPosition() to return a StringView instead of a String. listMarkerTextForNodeAndPosition() has a StringView internally and none it its call sites actually need a String. The call sites either use StringBuilder or want a NSString*. This avoids unnecessary String allocations.
Attachments
Patch (8.32 KB, patch)
2022-04-08 17:12 PDT, Chris Dumez
no flags
Patch (8.32 KB, patch)
2022-04-10 16:28 PDT, Chris Dumez
ews-feeder: commit-queue-
Radar WebKit Bug Importer
Comment 1 2022-04-08 17:09:44 PDT
Chris Dumez
Comment 2 2022-04-08 17:12:13 PDT
Darin Adler
Comment 3 2022-04-10 15:54:12 PDT
Comment on attachment 457129 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457129&action=review > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:684 > + [[attrString mutableString] appendString:text.createNSString().get()]; This could almost certainly be createNSStringWIthoutCopying() since mutable string functions take characters out of NSString objects, they don’t keep the NSString around.
Chris Dumez
Comment 4 2022-04-10 16:04:52 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 457129 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=457129&action=review > > > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:684 > > + [[attrString mutableString] appendString:text.createNSString().get()]; > > This could almost certainly be createNSStringWIthoutCopying() since mutable > string functions take characters out of NSString objects, they don’t keep > the NSString around. Ok. The previous code was actually using a createNSStringWithoutCopying() but looking at the doc for appendString:, I couldn't convince myself that it was safe. I'll go back to a createNSStringWithoutCopying() then.
Chris Dumez
Comment 5 2022-04-10 16:28:48 PDT
EWS
Comment 6 2022-04-10 18:33:33 PDT
Committed r292693 (249485@main): <https://commits.webkit.org/249485@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 457217 [details].
Note You need to log in before you can comment on or make changes to this bug.