Bug 234484 - [WTF] Remove RefCountedArray and use RefCountedFixedVector
Summary: [WTF] Remove RefCountedArray and use RefCountedFixedVector
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-18 21:35 PST by Yusuke Suzuki
Modified: 2021-12-21 02:40 PST (History)
12 users (show)

See Also:


Attachments
Patch (28.33 KB, patch)
2021-12-18 21:38 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).