build support for boilerplate protocols directly into the IPDL compiler
Categories
(Core :: IPC, enhancement, P2)
Tracking
()
People
(Reporter: froydnj, Unassigned)
References
(Blocks 1 open bug)
Details
Comment 1•6 years ago
|
||
| Reporter | ||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
When you were thinking about doing this in the IPDL compiler, was the implementation you were imagining basically just syntax sugar for a suite of child actors, or something more integrated?
| Reporter | ||
Comment 4•6 years ago
|
||
(In reply to Alex Gaynor [:Alex_Gaynor] from comment #3)
When you were thinking about doing this in the IPDL compiler, was the implementation you were imagining basically just syntax sugar for a suite of child actors, or something more integrated?
Do you mean "a suite of child messages"? I'm not clear on what the question is getting at.
The idea was that you declare something in the protocol description, and the IPDL compiler--let's use memory reporting, because that's very standardized--emits something so you don't have to write:
https://searchfox.org/mozilla-central/source/dom/media/ipc/RDDChild.cpp#61-86
https://searchfox.org/mozilla-central/source/dom/media/ipc/RDDParent.cpp#152-166
and supporting code. Well, maybe you have to add some inheritance declaration in your concrete actor class(es). Because those 40ish lines are virtually identical for all actors implementing memory reporting.
Crash reporting, skimming over it now, is a little harder, I think: setting up crash reporting is pretty standardized, but actually doing something with the crash report when things go wrong is not as standardized, so that would require a little more thought.
Comment 5•6 years ago
|
||
Ok, I spent a bit of time thinking about it, and I think I ended up roughly with where you were, but which I mis-read originally :-)
My idea was to add something roughly like:
protocol PFoo {
delegates PMemoryReporter;
};
This would be sort of like a child actor, except there'd always be one-PMemoryReporter for every PFoo. The IPDL compiler would add a little additional logic to OnMessageReceived to dispatch those messages. It'd also add a GetMemoryReporter()-or-similar method to PFoo which returned an instance. It would automatically use the concrete implementation of PMemoryReporter as discussed in bug 1512990, so we could just implement that once then delegate it in each child class.
Basically, the goal would be to get child-actor-like ability to group functionality together and reuse it, but without the child-actor lifecycle.
The end result is that a new top process simple adds (TM):
delegates PMemoryReporter, PProfiler, PTelemetry, ...;
And they get what we want.
Is that what you were describing originally? If so, whoops! I agree! I think I was confused by the idea of somehow making the IPDL compiler know about the idea of memory reporting specifically, instead of just knowing about how to handle this pattern of code reuse.
Updated•6 years ago
|
Updated•3 years ago
|
Description
•