On Tue, Dec 23, 2014 at 4:26 PM, Jonas Sicking <jo...@sicking.cc> wrote:
> On Tue, Dec 23, 2014 at 1:03 PM, Jeff Walden <jwalden+...@mit.edu> 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 like us to move away from this convention over time, > or at least stay away from it in the places that are fresher and > better-adjusted. > > As long as we can do that without incurring extra overhead. An > addref/release pair is fairly expensive for objects that are cycle > collected. > For what it's worth, thanks to the Snow White work done by Olli Pettay, doing an addref/release on a cycle collected pointer should be roughly as expensive as any other addref and release. The first addref or release of an object after a cycle collection will be more expensive, but the rest after that just have to do a little bit of extra bit twiddling in addition to the increment or decrement of the refcount. Andrew > > I guess passing references to an nsRef/COMPtr is a way to avoid > passing a raw pointer while also avoiding extra addrefs/releases. But > it's pretty ugly and also has a runtime cost. > > / Jonas > _______________________________________________ > 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