don't NS_ADDREF outparams when we can use smart pointers instead

RESOLVED FIXED in Firefox 40

Status

()

Core
General
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

unspecified
mozilla40
Points:
---

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(2 attachments)

Comment hidden (empty)
(Assignee)

Comment 1

3 years ago
Created attachment 8590878 [details] [diff] [review]
part 1 - use smart-pointer .forget() instead of NS_ADDREF+assign

If we're already holding something in a smart pointer, there's no need to
NS_ADDREF it on the way out, we can just .forget() into the outparam.
Attachment #8590878 - Flags: review?(ehsan)
(Assignee)

Comment 2

3 years ago
Created attachment 8590879 [details] [diff] [review]
part 2 - use smart pointers instead of manual NS_ADDREF'ing outparams

This cleans up several easy-to-handle usages of NS_ADDREF'ing raw pointers into
outparams by using smart pointers instead.
Attachment #8590879 - Flags: review?(ehsan)

Comment 3

3 years ago
Comment on attachment 8590878 [details] [diff] [review]
part 1 - use smart-pointer .forget() instead of NS_ADDREF+assign

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

::: netwerk/streamconv/nsStreamConverterService.cpp
@@ +550,2 @@
>          rv = listener->AsyncConvertData(aFromType, aToType, aListener, aContext);
> +        listener.forget(_retval);

Hmm, this changes the semantics of the code slightly, but hopefully that's ok...
Attachment #8590878 - Flags: review?(ehsan) → review+

Updated

3 years ago
Attachment #8590879 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/3fb0310f5f49
https://hg.mozilla.org/mozilla-central/rev/d7d35bcd761d
https://hg.mozilla.org/mozilla-central/rev/914fa009e6c7
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.