Closed
Bug 1312319
Opened 8 years ago
Closed 8 years ago
Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro for pure virtual AddRef/Release functions
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla54
People
(Reporter: kats, Assigned: kats)
Details
Attachments
(1 file)
What appears to be a common pattern in the code [1] is to have an "interface" type of class (with pure virtual methods) and allow RefPtrs to this interface. That requires having pure virtual AddRef/Release functions on the interface. It would be nice to have a macro that expands to this:
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
for use in such classes. Not sure if this belongs in MFBT or XPCOM glue. Classes that inherit from this interface can use one of the existing macros to provide an implementation of these functions, or can inherit the implementation from some other base class.
[1] See how many of the results in e.g. http://searchfox.org/mozilla-central/search?q=NS_IMETHOD_(MozExternalRefCountType)&case=false®exp=false&path= have pure virtual functions.
Assignee | ||
Comment 1•8 years ago
|
||
Bump. I was just about to file this bug again but it looks like I already filed it :)
Does anybody have objections to this?
Assignee | ||
Comment 2•8 years ago
|
||
There's even a name suggested at [1]: NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
[1] http://searchfox.org/mozilla-central/rev/bf98cd4315b5efa1b28831001ad27d54df7bbb68/dom/flyweb/HttpServer.h#38
Assignee: nobody → bugmail
Summary: Add a macro for pure virtual AddRef/Release functions → Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro for pure virtual AddRef/Release functions
Comment 3•8 years ago
|
||
No objection from me!
Assignee | ||
Comment 4•8 years ago
|
||
Comment hidden (mozreview-request) |
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8830465 [details]
Bug 1312319 - Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro and replace existing pure-virtual AddRef/Release declarations.
https://reviewboard.mozilla.org/r/107218/#review108616
Thanks for cleaning this up. Have to say that I'm kind of impressed that everybody declared it more-or-less the same way prior to this patch.
Attachment #8830465 -
Flags: review?(nfroyd) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ff0000b808c5
Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro and replace existing pure-virtual AddRef/Release declarations. r=froydnj
Comment 8•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Updated•8 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•