Closed Bug 1636047 Opened 4 years ago Closed 4 years ago

Adaptations to making nsTArray and AutoTArray non-copyable

Categories

(Thunderbird :: General, task)

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 78.0

People

(Reporter: sg, Assigned: benc)

References

Details

Attachments

(1 file)

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.

Is there a timeline on when this will be enforced?

Assignee: nobody → benc

This is going to land as soon as possible, probably next week. If we don't enforce it, new violating uses keep getting added.

Starting on this now. For reference, I think the final switchover patch is:
https://phabricator.services.mozilla.com/D73686

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.

Attachment #9146677 - Flags: review?(mkmelin+mozilla)
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
Attachment #9146677 - Flags: review?(mkmelin+mozilla) → review+
Status: NEW → ASSIGNED
Target Milestone: --- → Thunderbird 78.0

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

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: