Adaptations to making nsTArray and AutoTArray non-copyable
Categories
(Thunderbird :: General, task)
Tracking
(Not tracked)
People
(Reporter: sg, Assigned: benc)
References
Details
Attachments
(1 file)
20.74 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
Bug 1626570 will make nsTArray
and AutoTArray
non-copyable. This allows simplifications in their implementation, allow their instantiation with incomplete element types again, and will avoid accidental copies of large arrays.
This will require some adaptations in Thunderbird. Similar changes have been made on the patch throughout the Gecko/Firefox codebase, which may serve as a reference of what to do.
To summarize:
- In some cases, it may actually be possible to move instead of copy. Adding
std::move
appropriately will be the best solution. - In most cases, where moving is not possible, an explicit xvalue copy can be created by calling
Clone()
on the source array. - Where copy-constructibility/assignability is syntactically required,
CopyableTArray
resp.CopyablAutoTArray
can be used instead. This should only be done where really required, as it opens up again to accidental copies.
Reporter | ||
Comment 2•4 years ago
|
||
This is going to land as soon as possible, probably next week. If we don't enforce it, new violating uses keep getting added.
Assignee | ||
Comment 3•4 years ago
|
||
Starting on this now. For reference, I think the final switchover patch is:
https://phabricator.services.mozilla.com/D73686
Assignee | ||
Comment 4•4 years ago
|
||
This patch should keep us compiling when D73686 and all it's children land.
It works with or without the M-C changes, so we can land it in advance.
Comment 5•4 years ago
|
||
Comment on attachment 9146677 [details] [diff] [review] 1636047-non-copy-nsTArray-1.patch Review of attachment 9146677 [details] [diff] [review]: ----------------------------------------------------------------- I didn't try it out, but looks reasonable, thx! r=mkmelin
Updated•4 years ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/01d4d3db44e6
Handle non-copyable nsTArray and AutoTArray (introduced in bug 1626570). r=mkmelin
Description
•