.Append() on nsTArray copy constucts. The HTML5 parser needs a method that moves stuff over from another nsTArray and empties the other array withou running constructors/destructors. (In order to move around tree operations without leaking or prematurely deleting members that aren't refcounted but deleted when the tree op goes away.)
Attachment #402066 - Flags: review?(benjamin)
Comment on attachment 402066 [details] [diff] [review] Add MoveElementsFrom to nsTArray No other parts of nsTArray will assign from another array without copy construction: this seems like an unfortunate design decision.
SwapElements() kind of assigns from another array without copy construction.
Summary: Need a way to append the contents of an nsTArray to another withou copying → Need a way to append the contents of an nsTArray to another without copying
Attachment #402066 - Flags: superreview?(dbaron) → superreview+
Comment on attachment 402066 [details] [diff] [review] Add MoveElementsFrom to nsTArray sr=dbaron (assuming bsmedberg's review+), if you stick an NS_PRECONDITION(&array != this, "argument must be different array"); (or better assertion text) at the beginning
Comment on attachment 402066 [details] [diff] [review] Add MoveElementsFrom to nsTArray Please make the comment "Move all elements from another array to the end of this array without calling copy constructors or destructors."
Thank you for the reviews. Pushed with the changes suggested: http://hg.mozilla.org/mozilla-central/rev/f2a06414948c
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.