Closed Bug 1461450 Opened 3 years ago Closed 3 years ago

AutoTArray<T, N> objects do not have move constructors

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(2 files, 1 obsolete file)

They only define copy constructors and generic move constructors. A struct which contains an AutoTArray will always copy that array when being moved.

Bug 1185794 points out that it was ignored due to the issues with differently-sized objects, but that doesn't apply to identically-sized types.

We should support moving AutoTArray for identically-sized buffers.
Attachment #8975648 - Flags: review?(nfroyd)
Assignee: nobody → nika
Comment on attachment 8975648 [details] [diff] [review]
Support moving AutoTArray objects

Review of attachment 8975648 [details] [diff] [review]:
-----------------------------------------------------------------

Tests for this would be ideal.
Attachment #8975648 - Flags: review?(nfroyd) → review+
Nika, do you have time to get this landed? I think all we need is to add a simple test to `test_move_array` [1].

[1] https://searchfox.org/mozilla-central/rev/1193ef6a61cb6e350460eb2e8468184d3cb0321d/xpcom/tests/gtest/TestTArray2.cpp#300
Blocks: 1455891
Flags: needinfo?(nika)
Attachment #8975648 - Attachment is obsolete: true
Comment on attachment 8990477 [details] [diff] [review]
Part 2: Add tests for AutoTArray move constructors

Review of attachment 8990477 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks for adding the tests.
Attachment #8990477 - Flags: review?(erahm) → review+
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2a02d86bc113
Part 1: Add move constructors and assignment operators to nsTArray, r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/6e8148c1ca7f
Part 2: Add tests for AutoTArray move constructors, r=erahm
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a5d04cf5d67f
Part 1: Add move constructors and assignment operators to nsTArray, r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/44414b1cd32e
Part 2: Add tests for AutoTArray move constructors, r=erahm
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/961379be0f5e
Part 1: Add move constructors and assignment operators to nsTArray, r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/c721ada8a6d6
Part 2: Add tests for AutoTArray move constructors, r=erahm
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/252e00b20a4a
Part 1: Add move constructors and assignment operators to nsTArray, r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/2084dd0494b5
Part 2: Add tests for AutoTArray move constructors, r=erahm
https://hg.mozilla.org/mozilla-central/rev/252e00b20a4a
https://hg.mozilla.org/mozilla-central/rev/2084dd0494b5
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Flags: needinfo?(nika)
You need to log in before you can comment on or make changes to this bug.