On Wed, Aug 13, 2014 at 5:14 AM, Aryeh Gregor <a...@aryeh.name> wrote:
> I think this can be improved upon a bit further: just change
> already_AddRefed to behave more similarly to nsCOMPtr, but still not
> convert to T* implicitly.  So for instance:
>
> * Change ~already_AddRefed to just release the pointer instead of
> asserting.  This means it would be perfectly okay to ignore the result
> of a function that returns already_AddRefed.

What would be the goal of this? The goal of the initial email in this
thread appeared to be to reduce the number of classes in Gecko. This
doesn't seem to accomplish that.

The downside of doing this would be that it would lead to more overlap
between nsCOMPtr and already_AddRefed, which would lead to more
confusion about when to use which.

> * Make an already_AddRefed constructor from T* (which would addref).
> This allows you to return a raw pointer from a function with
> already_AddRefed return type, and it will do the right thing without
> you having to define an nsCOMPtr temporary.

A long long time ago John Keiser and I proposed adding a
|already_AddRefed<T*> do_AddRef(T*)| which would addref. It was shot
down by scc on basis that I never really understood.

I still think it would be a useful thing to have and fits in our
current architecture well.

/ Jonas
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to