On 08/12/2014 07:59 AM, Benjamin Smedberg wrote: > But now that nsCOMPtr/nsRefPtr support proper move constructors, [...] > Could we replace every already_AddRefed return value with a nsCOMPtr?
I have a variant of bsmedberg's original question here. He asked about return values, but I'm wondering: Could we replace every already_AddRefed *function-parameter* with a move reference to a RefPtr/nsCOMPtr? (Sorry if this was answered in this thread; I skimmed through it & didn't find a definitive answer immediately. It seems like this might be a strictly easier thing to fix up, as compared to return values.) As a concrete example, at this usage site... https://dxr.mozilla.org/mozilla-central/rev/1851b78b5a9673ee422f189b92e5f1e86b82a01c/dom/base/nsDOMMutationObserver.h#468 ...is there any benefit to us using already_AddRefed<nsPIDOMWindowInner>&& aOwner, instead of nsCOMPtr<nsPIDOMWindowInner>&&? (I believe we have the "already_AddRefed as a parameter" pattern in our code in order to avoid an extra addref/release when ownership is being transferred into a function. But, RefPtr/nsCOMPtr with move references would let us do that just as well, more concisely & less arcanely.) Thanks, ~Daniel _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform