----- Original Message ----- > On 2012-10-05 9:13 PM, Boris Zbarsky wrote: > > On 10/5/12 8:55 PM, Jonas Sicking wrote: > >> With WebIDL you don't even need to use XPCOM interfaces to expose > >> something to javascript! > > > > Indeed. As of a few days ago, you don't even need to inherit from > > nsISupports. ;) > > Nice! Can you please share some info on when you can avoid > inheriting > from nsISupports and whether we can make the cycle collector aware of > such objects?
For the latter question, in cycle collector parlance, cycle collected non-nsISupports classes are known as "native", and are declared using NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsFoo). They are implemented using NS_IMPL_CYCLE_COLLECTION_NATIVE_CLASS(nsFoo), and various TRAVERSE, UNLINK, etc macros that look similar to the standard ones, except they contain _NATIVE_. Ref counting for such classes can be declared using NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsFoo), which will declare the ref count, as well as the AddRef() and Release() methods. (There are also some non-inlined versions if you really want.) There are only about 10 of these classes, so making a native CCed class could be a little wonkier than usual. (Also, until recently (bug 750570), there was a known way these objects could possibly leak, but that should be fixed now.) Andrew > > Thanks! > Ehsan > > _______________________________________________ > 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