add a MakeUniqueFallible<T[]> (and maybe <T>) function

RESOLVED FIXED in Firefox 44



3 years ago
3 years ago


(Reporter: froydnj, Unassigned)


43 Branch

Firefox Tracking Flags

(firefox44 fixed, firefox45 fixed, b2g-v2.5 fixed)



(2 attachments)



3 years ago
In converting a few nsAuto*Ptr things to UniquePtr, one pattern that comes up is:

  mAutoPtr = new (fallible) T[...];

which has to be converted like so:

  mUniquePtr.reset(new (fallible) T[...]);

I think converting it like so would be nicer:

  mUniquePtr = MakeUniqueFallible<T[]>(...);

which is a little longer, but reads a little more idiomatically and doesn't use |new|.
Reasonable.  Separate header from the existing, is all I want here.  :-)  If we adopt <memory> at some point, want to keep extensions separated out.
How about mUniquePtr = MakeUnique<T[]>(..., fallible) ?
Don't think so.  It seems very worth preserving the sense that the arguments passed in, are exactly passed along.  Not to mention there'd then be ambiguity with a constructor that took a |fallible| as its last argument.

Comment 4

3 years ago
Created attachment 8682614 [details] [diff] [review]
add mozilla::MakeUniqueFallible and convert uses throughout the tree

Chose to call the file MakeUniqueExtensions in case we ever want to have
UniqueFreePtr etc.
Attachment #8682614 - Flags: review?(jwalden+bmo)
Attachment #8682614 - Flags: review?(jwalden+bmo) → review+

Comment 6

3 years ago
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Created attachment 8703908 [details] [diff] [review]
header only uplift for beta

Approval Request Comment
[Feature/regressing bug #]: none
[User impact if declined]: need this to uplift bug 1235605
[Describe test coverage new/current, TreeHerder]: none
[Risks and why]: safe
[String/UUID change made/needed]: none
Attachment #8703908 - Flags: feedback?(nfroyd)
Attachment #8703908 - Flags: approval-mozilla-beta?

Comment 8

3 years ago
Comment on attachment 8703908 [details] [diff] [review]
header only uplift for beta

Review of attachment 8703908 [details] [diff] [review]:

Attachment #8703908 - Flags: feedback?(nfroyd) → feedback+
Comment on attachment 8703908 [details] [diff] [review]
header only uplift for beta

Need to fix a sec-mod issue. Beta44+
Attachment #8703908 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
status-firefox44: --- → affected

Comment 10

3 years ago
status-firefox44: affected → fixed
You need to log in before you can comment on or make changes to this bug.