Conceptually already_AddRefed<T> is a move reference.  And it's destructor
asserts (in debug builds) that the reference was indeed moved, so it cannot
be used as a conditional transfer under any circumstances.

- Kyle

On Thu, Mar 17, 2016 at 8:07 PM, <jww...@mozilla.com> wrote:

>
> https://hg.mozilla.org/mozilla-central/file/3e04659fdf6aef792f7cf9840189c6c38d08d1e8/mfbt/UniquePtr.h#l182
>
> "To unconditionally transfer ownership of a UniquePtr into a method, use a
> |UniquePtr| argument.  To conditionally transfer ownership of a resource
> into a method, should the method want it, use a |UniquePtr&&| argument."
>
> Does that also apply to already_AddRefed<>&& or we stick to
> https://bugzilla.mozilla.org/show_bug.cgi?id=1247972#c19?
>
> Btw, we have some code like
> https://hg.mozilla.org/mozilla-central/file/3e04659fdf6aef792f7cf9840189c6c38d08d1e8/dom/base/WebSocket.cpp#l2790
> where it really should be just already_AddRefed<> since the ownership is
> always transferred.
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to