Closed Bug 1259706 Opened 6 years ago Closed 6 years ago
_INLINE _DECL _THREADSAFE _REFCOUNTING macro equivalent that declare Add Ref and Release as virtual
58 bytes, text/x-review-board-request
It would be useful to be able to declare the AddRef and Release method as virtual so that they can be overridden in inheriting class. Something like NS_INLINE_IDECL_THREADSAFE_REFCOUNTING I think it would be much better if NS_INLINE_DECL_THREADSAFE_REFCOUNTING simply declared those functions as virtual all the time, but seeing it's been like this for over a decade it's probably preferred as it is.
Allow to generate virtual AddRef/Release methods. Review commit: https://reviewboard.mozilla.org/r/42455/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/42455/
Attachment #8734703 - Flags: review?(nfroyd)
Attachment #8734703 - Flags: review?(nfroyd) → review+
Comment on attachment 8734703 [details] MozReview Request: Bug 1259706: Add NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING macro. r=froydnj https://reviewboard.mozilla.org/r/42455/#review39623 r=me with the change below. I think the name should feature `VIRTUAL` in it, but am happy to hear other suggestions for naming. ::: xpcom/glue/nsISupportsImpl.h:568 (Diff revision 1) > + > +/** > + * Like NS_INLINE_DECL_THREADSAFE_REFCOUNTING with AddRef & Release declared > + * virtual. > + */ > +#define NS_INLINE_IDECL_THREADSAFE_REFCOUNTING(_class, ...) \ I think the `I` here is a little hard to miss. Let's name it sort-of-consistently with the patches for bug 1184283. Perhaps `NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING`?
Sounds good to me with virtual. I had used the "I" because the other addRef/Release declaration that are virtuals only differs by the letter I (NS_METHOD vs NS_IMETHOD)
Comment on attachment 8734703 [details] MozReview Request: Bug 1259706: Add NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING macro. r=froydnj Review request updated; see interdiff: https://reviewboard.mozilla.org/r/42455/diff/1-2/
Attachment #8734703 - Attachment description: MozReview Request: Bug 1259706: Add NS_INLINE_IDECL_THREADSAFE_REFCOUNTING macro. r?froydnj → MozReview Request: Bug 1259706: Add NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING macro. r=froydnj
You need to log in before you can comment on or make changes to this bug.