Closed
Bug 1097731
Opened 10 years ago
Closed 10 years ago
inherit infallible wrapper method
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: tromey, Assigned: tromey)
Details
Attachments
(1 file)
3.74 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
Currently the IDL-to-C++ translator will generate convenience wrappers for infallible attributes, like: inline bool GetRecordProfileTimelineMarkers() { bool result; mozilla::DebugOnly<nsresult> rv = GetRecordProfileTimelineMarkers(&result); MOZ_ASSERT(NS_SUCCEEDED(rv)); return result; } However, as you can see from https://bugzilla.mozilla.org/show_bug.cgi?id=1050774#c38 ... it can be hard to use these wrappers. What happened there is that the concrete class implemented the "ordinary" getter, and this implementation shadowed the convenience wrapper. It looked simple to change the translator to emit a "using" declaration for the convenience method as well. This makes it straightforward to use the wrapper.
Assignee | ||
Comment 1•10 years ago
|
||
This patch adds "using" declarations so that infallible wrapper methods are available on a class implementing the interface. I have only tested this by rebuilding (and by hacking in a use of the new wrapper), as I wasn't sure it was a worthwhile enough idea to push through try. This patch adds the using declaration to the NS_DECL_ and NS_FORWARD_ macros, but not the NS_FORWARD_SAFE_ macro. The latter was omitted because it seemed incorrect to me -- in that case the method can fail if passed a NULL "to_".
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ttromey
Assignee | ||
Comment 2•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=ecafa6bd1a5b
Assignee | ||
Updated•10 years ago
|
Attachment #8521473 -
Flags: review?(benjamin)
Updated•10 years ago
|
Attachment #8521473 -
Flags: review?(benjamin) → review?(nfroyd)
Comment 3•10 years ago
|
||
Comment on attachment 8521473 [details] [diff] [review] emit using declarations for infallible convenience methods Review of attachment 8521473 [details] [diff] [review]: ----------------------------------------------------------------- This C++ behavior seems inconsistently weird to me, but...
Attachment #8521473 -
Flags: review?(nfroyd) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 4•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/60c584a2bfa1
Keywords: checkin-needed
Comment 5•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/60c584a2bfa1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•