Closed Bug 1332321 Opened 7 years ago Closed 7 years ago

The *SKIPPABLE_*_INHERITED macros are footguns

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox53 --- affected
firefox54 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

If class A inherits from B, A uses one of the *SKIPPABLE_*_INHERITED macros, and B does _not_ use a skippable macro, then A's skippability stuff will never get called.  That's because it's based on a boolean that only the least-derived CC participant gets to set.

So you can write all this nice skippability code and have it all be dead code and never even notice.
One simple solution may be to just have a ctor for the participant that calls its parent participant ctor in a way that only skippable participants implement or something.

Another is to make all participant ctors take a skippability arg and propagate it up with skippable things adding in "true" and the default value always being false or something.  This would allow a skippable subclass of a non-skippable superclass and just invoke the canskip bits on the subclass.
This way we can't end up with a situation in which an ancestor doesn't care about skippability but a descendant does and doesn't get it, because the ancestor just claimed no skippability was needed.
Attachment #8829959 - Flags: review?(continuation)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8829959 [details] [diff] [review]
Make all cycle collection participants explicitly say whether they need skippability themselves, or just want whatever skippability their descendants want

Review of attachment 8829959 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.
Attachment #8829959 - Flags: review?(continuation) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/226f342c26fb
Make all cycle collection participants explicitly say whether they need skippability themselves, or just want whatever skippability their descendants want. r=mccr8
https://hg.mozilla.org/mozilla-central/rev/226f342c26fb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: