use mozilla::Variant to define IPDL unions

NEW
Unassigned

Status

()

Core
IPC
2 years ago
2 years ago

People

(Reporter: froydnj, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

There's a fair bit of code generated in service of generating tagged unions in the ipdl code generator.  If we converted all that to using mozilla::Variant, there would be a lot of code that went away, and we might be able to get rid of the duplication of IPDL serialization methods for common structures across protocols as well.  (Maybe even getting rid of the awful hack we use for making things work correctly with Read/Write.)

I'm not sure how deeply baked in the idea of being able to check the union's type with the tag is, though.  It might not be very feasible.
(In reply to Nathan Froyd [:froydnj] from comment #0)
> I'm not sure how deeply baked in the idea of being able to check the union's
> type with the tag is, though.  It might not be very feasible.

That's used in a ton of places :-/
See Also: → bug 1209227

Comment 2

2 years ago
Type checking is a pretty fundamental feature of the IPDL union types. I must admit after reading the mozilla/Variant.h header I'm still pretty clueless about what it's good for and not good for. But since unions can contain both plain data and actors, I don't know how we can avoid IPDL having deep knowledge of the contents of unions so that it can do the proper state checking on actors.
You need to log in before you can comment on or make changes to this bug.