add more static asserts for cycle collection macro usage

NEW
Unassigned

Status

()

defect
7 years ago
7 years ago

People

(Reporter: mccr8, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

7 years ago
There are a lot of footguns in declaring cycle collected classes. We should try to add more static asserts. I'm just thinking very basic things about using the right macros together. I'm not sure how doable these are going to be.

Here are a few that Ehsan hit (and I've hit one before, too):

- You've declared a TRACE function for your class, but you are using NS_IMPL_CYCLE_COLLECTION_NATIVE_CLASS, so the function won't get used in the ccvtable.

- Using NS_IMPL_CYCLE_COLLECTION_CLASS, but you have a non-XPCOM class.

One brute force way to do this would be to add a debug-only const field to the class that specifies what kind of CC class it is, and then the macros could check that they all agree. This will require refactoring the macros a bit.
You need to log in before you can comment on or make changes to this bug.