Closed Bug 1354642 Opened 2 years ago Closed 2 years ago

Add MakeRefPtr.

Categories

(Core :: MFBT, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jib, Assigned: jib)

References

Details

Attachments

(1 file)

I was reviewing some code in bug 1320994 comment 22 which could really have used a MakeRefPtr:

> RefPtr<Refcountable<UniquePtr<OnTracksAvailableCallback>>> tracksAvailableCallback =
>     MakeAndAddRef<Refcountable<UniquePtr<OnTracksAvailableCallback>>>(
>         mManager, mOnSuccess, mWindowID, domStream);

With MakePtr it would be a svelte:
> auto tracksAvailableCallback = MakeRefPtr<Refcountable<UniquePtr<OnTracksAvailableCallback>>>(
>     mManager, mOnSuccess, mWindowID, domStream);

I saw mention of MakeRefPtr in bug 1208262 comment 10, and ehsan ok'ed reviewing a patch for it on irc. Thanks!

I don't think we need to convert the world or anything, but it sure helps with those really long ones.
See Also: → 1208262
Comment on attachment 8855912 [details]
Bug 1354642 - Add MakeRefPtr<> helper class.

https://reviewboard.mozilla.org/r/127796/#review135396

Thanks for the patch, and sorry for the long delay..
Attachment #8855912 - Flags: review?(ehsan) → review+
Pushed by jbruaroey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/66bfd5c79d98
Add MakeRefPtr<> helper class. r=Ehsan
https://hg.mozilla.org/mozilla-central/rev/66bfd5c79d98
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.