Refactor ListFormat::FormatToParts
Categories
(Core :: Internationalization, enhancement, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox96 | --- | fixed |
People
(Reporter: allstars.chh, Assigned: allstars.chh)
References
Details
Attachments
(3 files)
There are some improvements learned from DateTimeFormat implementation that could help ListFormat::FormatToParts, for example:
-
No need to use a callback.
We could pass a Buffer, and that buffer holds the string result, so the strings got for ICU could still remain valid after the FormatToParts call.
Also, when I implemented DateIntervalFormat, I found std::function will do heap allocation when the lambda size is too large. -
Simplify the data structures in ListFormat::Part.
We could just store an index to the string buffer, instead of a Mozilla::Span.
Comment 1•3 years ago
|
||
Marking this as P4 since it's on the non-critical path for unification, that way it won't show up in the graph for the KRs. Feel free to continue the clean-up on it though.
Assignee | ||
Comment 2•3 years ago
|
||
This AutoFormatResult class could be shared later by ListFormat.
Assignee | ||
Comment 3•3 years ago
|
||
The caller now will provide a buffer, which owns the memory pointed by the span.
Assignee | ||
Comment 4•3 years ago
|
||
![]() |
||
Comment 6•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9459574a7ee2
https://hg.mozilla.org/mozilla-central/rev/a3a54dca1620
https://hg.mozilla.org/mozilla-central/rev/0480317c00e5
Description
•