Re: Getting rid of already_AddRefed?

2014-12-23 Thread Boris Zbarsky
On 12/23/14 1:03 PM, Jeff Walden wrote: And concerning the binary compatibility argument -- which I don't think really matters any more Oh, I wish you were right. Things like bug 1078674 suggest that you're wrong, however. We have random binary code we don't control calling into our code, s

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 5:30 PM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 2:19 PM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2014-12-23 5:13 PM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 2:07 PM, L. David Baron mailto:dba...@dbaron.org>

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 2:19 PM, Ehsan Akhgari wrote: > On 2014-12-23 5:13 PM, Eric Rescorla wrote: > >> On Tue, Dec 23, 2014 at 2:07 PM, L. David Baron > > wrote: >> >> On Tuesday 2014-12-23 14:03 -0800, Eric Rescorla wrote: >> > This may be a much longer argume

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 5:13 PM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 2:07 PM, L. David Baron mailto:dba...@dbaron.org>> wrote: On Tuesday 2014-12-23 14:03 -0800, Eric Rescorla wrote: > This may be a much longer argument, but I'm not convinced that > sacrificing what would otherwise be

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 2:07 PM, L. David Baron wrote: > On Tuesday 2014-12-23 14:03 -0800, Eric Rescorla wrote: > > This may be a much longer argument, but I'm not convinced that > > sacrificing what would otherwise be good programming practice > > (never unboxing your pointers) at the altar of

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 14:03 -0800, Eric Rescorla wrote: > This may be a much longer argument, but I'm not convinced that > sacrificing what would otherwise be good programming practice > (never unboxing your pointers) at the altar of performance is a good > idea. Why do you think never unboxing po

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 13:59 -0800, Martin Thomson wrote: > Why are you surprised that when you pass a pointer to a function that the > function gets a pointer? You're putting words in my mouth. > I agree that the performance is less than perfect. I do have to ask: at > what point do you consider

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 1:51 PM, L. David Baron wrote: > On Tuesday 2014-12-23 13:14 -0800, Eric Rescorla wrote: > > Just to be clear, is your problem the implicit conversion itself > > or the reference count increment/decrement? > > The latter -- the problem is that there's an implicit conversio

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Martin Thomson
On Tue, Dec 23, 2014 at 1:51 PM, L. David Baron wrote: > > > Just to be clear, is your problem the implicit conversion itself > > or the reference count increment/decrement? > > The latter -- the problem is that there's an implicit conversion > that has surprising side-effects. Why are you surpr

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 13:14 -0800, Eric Rescorla wrote: > Just to be clear, is your problem the implicit conversion itself > or the reference count increment/decrement? The latter -- the problem is that there's an implicit conversion that has surprising side-effects. (It sounds from this discussi

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Jonas Sicking
On Tue, Dec 23, 2014 at 1:03 PM, Jeff Walden wrote: > On 12/23/2014 10:48 AM, L. David Baron wrote: >> Our convention has always been to pass raw pointers, generally with >> the assumption that the caller is expected to ensure the pointer >> lives across the function call. > > Like Eric, I would l

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 10:14 AM, L. David Baron wrote: > On Tuesday 2014-12-23 09:59 -0800, Martin Thomson wrote: > > On Tue, Dec 23, 2014 at 9:55 AM, L. David Baron > wrote: > > > > > > But that's an implicit constructor that's causing extra refcount > > > traffic, which is one of the things w

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Jeff Walden
On 12/23/2014 10:48 AM, L. David Baron wrote: > Our convention has always been to pass raw pointers, generally with > the assumption that the caller is expected to ensure the pointer > lives across the function call. Like Eric, I would like us to move away from this convention over time, or at le

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 09:59 -0800, Martin Thomson wrote: > On Tue, Dec 23, 2014 at 9:55 AM, L. David Baron wrote: > > > > But that's an implicit constructor that's causing extra refcount > > traffic, which is one of the things we didn't want here. > > > > I don't think that it's quite fair to c

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 12:51 PM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 8:53 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2014-12-23 11:36 AM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 8:32 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Martin Thomson
On Tue, Dec 23, 2014 at 9:55 AM, L. David Baron wrote: > > But that's an implicit constructor that's causing extra refcount > traffic, which is one of the things we didn't want here. I don't think that it's quite fair to complain about implicit conversion if the whole point is to enable implici

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 09:49 -0800, Eric Rescorla wrote: > Hmm... This seems to work fine with RefPtr, but it *doesn't* work > with nsRefPtr (see end of message for the test code). I'm guessing > because of: > > http://dxr.mozilla.org/mozilla-central/source/mfbt/RefPtr.h?from=RefPtr&case=true#239

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 8:53 AM, Ehsan Akhgari wrote: > On 2014-12-23 11:36 AM, Eric Rescorla wrote: > >> >> >> On Tue, Dec 23, 2014 at 8:32 AM, Ehsan Akhgari > > wrote: >> >> On 2014-12-23 10:38 AM, Eric Rescorla wrote: >> >> >> >> On Tue, Dec 23, 2014

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 8:48 AM, L. David Baron wrote: > On Tuesday 2014-12-23 08:36 -0800, Eric Rescorla wrote: > > > Why not pass the raw pointer to the function? > > > > > > My general theory is that smart pointers, once boxed, should never be > > unboxed. > > The major arguments I see for unb

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 11:36 AM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 8:32 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2014-12-23 10:38 AM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 6:48 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>

Re: Getting rid of already_AddRefed?

2014-12-23 Thread L. David Baron
On Tuesday 2014-12-23 08:36 -0800, Eric Rescorla wrote: > > Why not pass the raw pointer to the function? > > > My general theory is that smart pointers, once boxed, should never be > unboxed. > The major arguments I see for unboxing is performance, but if you pass a > ref, > then you don't have

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 8:32 AM, Ehsan Akhgari wrote: > On 2014-12-23 10:38 AM, Eric Rescorla wrote: > >> >> >> On Tue, Dec 23, 2014 at 6:48 AM, Ehsan Akhgari > > wrote: >> >> On 2014-12-22 6:52 PM, Eric Rescorla wrote: >> >> >> >> On Mon, Dec 22, 2014

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 10:38 AM, Eric Rescorla wrote: On Tue, Dec 23, 2014 at 6:48 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2014-12-22 6:52 PM, Eric Rescorla wrote: On Mon, Dec 22, 2014 at 3:35 PM, L. David Baron mailto:dba...@dbaron.org>

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Eric Rescorla
On Tue, Dec 23, 2014 at 6:48 AM, Ehsan Akhgari wrote: > On 2014-12-22 6:52 PM, Eric Rescorla wrote: > >> >> >> On Mon, Dec 22, 2014 at 3:35 PM, L. David Baron > > wrote: >> >> On Monday 2014-12-22 18:21 -0500, Ehsan Akhgari wrote: >> > On 2014-12-22 6:07 PM, L. D

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 9:47 AM, Ehsan Akhgari wrote: On 2014-12-23 2:52 AM, Ms2ger wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/23/2014 12:45 AM, Ehsan Akhgari wrote: On 2014-12-22 6:35 PM, L. David Baron wrote: On Monday 2014-12-22 18:21 -0500, Ehsan Akhgari wrote: On 2014-12-22 6:07 P

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-22 6:52 PM, Eric Rescorla wrote: On Mon, Dec 22, 2014 at 3:35 PM, L. David Baron mailto:dba...@dbaron.org>> wrote: On Monday 2014-12-22 18:21 -0500, Ehsan Akhgari wrote: > On 2014-12-22 6:07 PM, L. David Baron wrote: > >On Monday 2014-12-22 17:54 -0500, Ehsan Akhgari wro

Re: Getting rid of already_AddRefed?

2014-12-23 Thread Ehsan Akhgari
On 2014-12-23 2:52 AM, Ms2ger wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/23/2014 12:45 AM, Ehsan Akhgari wrote: On 2014-12-22 6:35 PM, L. David Baron wrote: On Monday 2014-12-22 18:21 -0500, Ehsan Akhgari wrote: On 2014-12-22 6:07 PM, L. David Baron wrote: On Monday 2014-12-2