Support ResizeToFit() for non-pod type in mozilla::Vector
Categories
(Core :: MFBT, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: boris, Assigned: emilio)
References
()
Details
Attachments
(1 file)
See https://phabricator.services.mozilla.com/D60045#inline-367732, we would like to use Vector
as the container for StyleTransformOperation
and convert it into StyleOwnSliced directly (without any copy). For now, we add an assertion if its capacity is different from its length to make sure we don't leak.
However, the best way is to support something like ResizeToFit() for non-POD types, and then we can drop the assertion.
Assignee | ||
Comment 1•4 years ago
|
||
Probably shrinkStorageToFit
or something like that?
And this is not really about leaking, but about Rust allocator requiring the capacity (though I believe mozalloc doesn't) and thus making boxed slices just length == capacity
, and OwnedSlice maintaining that. Though it'd be useful more generally I bet.
Reporter | ||
Comment 2•4 years ago
|
||
OK. I see. Thanks for the clarification.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f5d0ed5f15d4 Generalize Vector::podResizeToFit into Vector::shrinkStorageToFit(). r=froydnj
Comment 5•4 years ago
|
||
bugherder |
Description
•