On Thu, May 4, 2017 at 12:32 PM, Henri Sivonen <hsivo...@hsivonen.fi> wrote: > On Thu, May 4, 2017 at 4:27 PM, Nathan Froyd <nfr...@mozilla.com> wrote: >> On Thu, May 4, 2017 at 3:08 AM, Henri Sivonen <hsivo...@hsivonen.fi> wrote: >>> Is it feasible (with reasonably low effort) to introduce a new XPIDL >>> type that is a pointer to a non-refcounted immutable static object in >>> C++ and still gets bridged to JS? >> >> You can certainly have static objects with what amount to dummy >> AddRef/Release methods passed through XPIDL (we do this in a couple of >> places throughout Gecko), but I don't think you can get away with >> having a non-refcounted object passed through XPIDL. > > Do the AddRef/Release need to be virtual?
Yes. (I'm not sure how XPConnect would discover the refcounting methods if they were non-virtual.) Please note that the static objects with dummy AddRef/Release methods also implement XPConnect interfaces, i.e. QueryInterface, nsresult virtual methods, etc. I think you could possibly make your things a WebIDL interface, which don't require refcounting, and magically make the WebIDL interfaces work with XPIDL, but I do not know the details there. -Nathan _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform