Bug 234484

Summary: [WTF] Remove RefCountedArray and use RefCountedFixedVector
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, cdumez, cmarcelo, darin, dino, ews-watchlist, gyuyoung.kim, mmaxfield, ryuan.choi, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Yusuke Suzuki 2021-12-18 21:35:40 PST
[WTF] Remove RefCountedArray and use RefCountedFixedVector
Comment 1 Yusuke Suzuki 2021-12-18 21:38:06 PST
Created attachment 447540 [details]
Patch
Comment 2 Yusuke Suzuki 2021-12-21 02:02:46 PST
Comment on attachment 447540 [details]
Patch

Thanks!
Comment 3 Darin Adler 2021-12-21 02:10:57 PST
Related: In new code should start making our argument types and return types be Span<> instead of const Vector<>& or const FixedVector<>&. Find to still have argument types that are Vector<>&& or FixedVector<>&&, and return types that are Vector<> or FixedVector<>, but not references, because Span is more flexible and can return things from a std::array<>, a Vector<>, a FixedVector<>, a pointer to a single value, or a subspan of any of those. I think we’ll end up with better code.
Comment 4 EWS 2021-12-21 02:34:16 PST
Committed r287308 (245460@main): <https://commits.webkit.org/245460@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447540 [details].
Comment 5 Radar WebKit Bug Importer 2021-12-21 02:35:18 PST
<rdar://problem/86760816>
Comment 6 Yusuke Suzuki 2021-12-21 02:40:22 PST
(In reply to Darin Adler from comment #3)
> Related: In new code should start making our argument types and return types
> be Span<> instead of const Vector<>& or const FixedVector<>&. Find to still
> have argument types that are Vector<>&& or FixedVector<>&&, and return types
> that are Vector<> or FixedVector<>, but not references, because Span is more
> flexible and can return things from a std::array<>, a Vector<>, a
> FixedVector<>, a pointer to a single value, or a subspan of any of those. I
> think we’ll end up with better code.

Yeah, Span<> is useful, and we can probably use it more!
But in this case, we are using RefCountedFixedVector (not FixedVector) intentionally here since FontCascadeDescription shares RefCountedFixedVector of the other FontCascadeDescription.
And the existing method is returning `RefCountedFixedVector&` (previously, `RefCountedArray&`) to pass it to the other FontCascadeDescription sharing it. (that's why this is ref-counted, and neither Vector nor FixedVector).