Re: mozilla::RefPtr is dead, long live ::RefPtr

2015-10-18 Thread Kyle Huey
Huzzah!

When are you going to do nsCOMPtr? ;)

- Kyle

On Sun, Oct 18, 2015 at 7:43 AM, Nathan Froyd  wrote:
> Hi all,
>
> Bug 1207245 has landed on mozilla-central.  Its main purpose in life is to
> unify mozilla::RefPtr and nsRefPtr (both of which live in MFBT) into a
> single RefPtr class.  This new RefPtr class, like nsRefPtr, lives at the
> *global* scope, not in the mozilla:: namespace.  Follow-up patches or ideas
> on how to fix this welcome; I have brute-force ideas on how to do it, but
> they require large quantities of machine time.
>
> The new RefPtr works exactly the same as the old nsRefPtr: getter_AddRefs,
> interoperation with nsCOMPtr, etc.  It's worth noting that if you used
> byRef with mozilla::RefPtr for (XP)COM outparam semantics, you'll have to
> use getter_AddRefs now instead.  Please note that getter_AddRefs zeroes out
> the pointer prior to passing it as an outparam (as it has always done),
> which byRef did *not* do.  (You should not have been depending on this
> behavior, but if you were...)
>
> Updating patches/commits affected by these changes should be as simple as
> running:
>
> perl -p -i -e 's#mozilla/nsRefPtr.h#mozilla/RefPtr.h#'
> perl -p -i -e 's#mozilla::RefPtr#RefPtr#'
> perl -p -i -e 's#nsRefPtr<#RefPtr<#'
> perl -p -i -e 's#byRef#getter_AddRefs#'
>
> over the affected files.
>
> As a side-effect of these changes, mozilla::RefCounted and
> mozilla::external::AtomicRefCounted have moved to their own header,
> mozilla/RefCounted.h.
>
> Happy hacking,
> -Nathan
> ___
> 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


Re: mozilla::RefPtr is dead, long live ::RefPtr

2015-10-18 Thread Boris Zbarsky

On 10/18/15 10:43 AM, Nathan Froyd wrote:

Bug 1207245 has landed on mozilla-central.


Are we sure enough this will stick that we should update documentation 
(e.g. 
) to 
refer to RefPtr instead of nsRefPtr?


-Boris
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


mozilla::RefPtr is dead, long live ::RefPtr

2015-10-18 Thread Nathan Froyd
Hi all,

Bug 1207245 has landed on mozilla-central.  Its main purpose in life is to
unify mozilla::RefPtr and nsRefPtr (both of which live in MFBT) into a
single RefPtr class.  This new RefPtr class, like nsRefPtr, lives at the
*global* scope, not in the mozilla:: namespace.  Follow-up patches or ideas
on how to fix this welcome; I have brute-force ideas on how to do it, but
they require large quantities of machine time.

The new RefPtr works exactly the same as the old nsRefPtr: getter_AddRefs,
interoperation with nsCOMPtr, etc.  It's worth noting that if you used
byRef with mozilla::RefPtr for (XP)COM outparam semantics, you'll have to
use getter_AddRefs now instead.  Please note that getter_AddRefs zeroes out
the pointer prior to passing it as an outparam (as it has always done),
which byRef did *not* do.  (You should not have been depending on this
behavior, but if you were...)

Updating patches/commits affected by these changes should be as simple as
running:

perl -p -i -e 's#mozilla/nsRefPtr.h#mozilla/RefPtr.h#'
perl -p -i -e 's#mozilla::RefPtr#RefPtr#'
perl -p -i -e 's#nsRefPtr<#RefPtr<#'
perl -p -i -e 's#byRef#getter_AddRefs#'

over the affected files.

As a side-effect of these changes, mozilla::RefCounted and
mozilla::external::AtomicRefCounted have moved to their own header,
mozilla/RefCounted.h.

Happy hacking,
-Nathan
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: mozilla::RefPtr is dead, long live ::RefPtr

2015-10-18 Thread Boris Zbarsky

On 10/18/15 11:11 AM, Kyle Huey wrote:

When are you going to do nsCOMPtr? ;)


Are we sure there is no codesize hit when moving from nsCOMPtr (which 
tries to share implementation via nsCOMPtr_base) to RefPtr?


-Boris
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: mozilla::RefPtr is dead, long live ::RefPtr

2015-10-18 Thread Kyle Huey
I meant removing the ns prefix (i.e. s/nsCOMPtr/COMPtr/), which is the
net effect of this change for places that previous used nsRefPtr,
AIUI.

- Kyle

On Sun, Oct 18, 2015 at 8:24 AM, Boris Zbarsky  wrote:
> On 10/18/15 11:11 AM, Kyle Huey wrote:
>>
>> When are you going to do nsCOMPtr? ;)
>
>
> Are we sure there is no codesize hit when moving from nsCOMPtr (which tries
> to share implementation via nsCOMPtr_base) to RefPtr?
>
> -Boris
>
> ___
> 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