Use a message router for primary child process channels
Categories
(Core :: IPC, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox91 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
References
Details
Crash Data
Attachments
(16 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
This patch imports the core algorithms from the mojo/core/ports directory in the chromium tree, and build our own NodeController and NodeChannel objects on top of them. Our objects are simpler and don't support as many features as mojo's system API, but integrate cleanly with our existing infrastructure.
The "ports" directory was imported to keep the amount of code being forked low, to avoid potential issues caused by us not keeping up with upstream. The code in this directory is platform independent, well contained, and has relatively few dependencies on base, so can be more easily forked and integrated into libxul.
Many of the useful features supported by the ports library haven't been implemented in NodeController yet, including sending ports as attachments to other ports, and out-of-order processing of user messages to allow routing handles etc. through the broker.
Currently this is more of an experimental prototype, but the difficulty of the integration and the number of features it provides us makes it seem like a promising approach to fixing bug 1706368.
| Assignee | ||
Comment 1•4 years ago
|
||
This initial import does not build, and will be made to build in following
parts.
| Assignee | ||
Comment 2•4 years ago
|
||
| Assignee | ||
Comment 3•4 years ago
|
||
This involves replacing a number of types normally provided by chromium's
base with their XPCOM counterparts etc.
| Assignee | ||
Comment 4•4 years ago
|
||
The ports library import came with 2 gtests. This patch gets them running under
our gtest runner to ensure we don't break the ports functionality.
| Assignee | ||
Comment 5•4 years ago
|
||
Mechanical change applying clang-tidy fixes
| Assignee | ||
Comment 6•4 years ago
|
||
Mechanical change applying clang-tidy fixes
| Assignee | ||
Comment 7•4 years ago
|
||
| Assignee | ||
Comment 8•4 years ago
|
||
| Assignee | ||
Comment 9•4 years ago
|
||
These will be used to serialize extra event metadata into IPC messages when
they're sent over the ports infrastructure. In the future better integration
may be used to reduce the overhead of this if necessary.
| Assignee | ||
Comment 10•4 years ago
|
||
This will be used to handle pre-opened channels more reliably in ports code.
| Assignee | ||
Comment 11•4 years ago
|
||
The NodeController and NodeChannel types act as the backbone connecting the
existing IPC logic and driving the ports routing code. Individual NodeChannel
objects wrap and respond to messages from IPC::Channel, and the NodeController
orchestrates all messaging for a process.
The design of these types are inspired by the types with the same names from
Mojo but have been simplified and streamlined to only support features used by
Gecko.
Support for attaching ports or handles to messages hasn't been added yet, but
can be added in follow-up patches.
| Assignee | ||
Comment 12•4 years ago
|
||
This also consumes the existing channel created when launching a process to
create the the conneciton required by NodeController for communicating between
processes. In part 11b, consumers of the broken APIs will be adjusted to use
the new interface.
The new routing approach is not used for the fork server process, as an IO
thread and the NodeController object cannot be initialized before the fork has
been performed, and the IPC requirements of that process are fairly minimal.
| Assignee | ||
Comment 13•4 years ago
|
||
This extends on the changes in part 11a and consumes the new PortRef-based API
in all existing process types other than the fork server. The IPDL C++ unit
tests were already broken before this change, and were not updated.
| Assignee | ||
Comment 14•4 years ago
|
||
| Assignee | ||
Comment 15•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
| Assignee | ||
Comment 16•4 years ago
|
||
This unfortunately requires a new method to be added to BufferList to
support truncating the buffer to a particular iterator.
| Assignee | ||
Comment 17•4 years ago
|
||
This should improve the performance of large calls to AdvanceAcrossSegments
when using a very large BufferList, as we no longer need to iterate over each
element to find the destination when the call is closer to the end.
This will be used most frequently with the new footer code to seek to the end
of an IPC message to read out the footer.
| Assignee | ||
Comment 18•4 years ago
|
||
Ended up doing some perf runs (talos & vismet browsertime at :jesup's suggestion) with these patches & bug ??? to make sure we weren't causing any serious regressions. They seem somewhat all-over-the-place, but I'm also not the best at reading this perf results :-)
Comment 19•4 years ago
|
||
Comment 20•4 years ago
|
||
Comment 21•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/5f4eeba79d24
https://hg.mozilla.org/mozilla-central/rev/eab1b9e3812c
https://hg.mozilla.org/mozilla-central/rev/7eeaa99e54cb
https://hg.mozilla.org/mozilla-central/rev/e68ae9bac0f4
https://hg.mozilla.org/mozilla-central/rev/0f54df9a9e71
https://hg.mozilla.org/mozilla-central/rev/b6cffd49343e
https://hg.mozilla.org/mozilla-central/rev/1a82a6ec42ac
https://hg.mozilla.org/mozilla-central/rev/b0810c6655ed
https://hg.mozilla.org/mozilla-central/rev/3b2722d8636b
https://hg.mozilla.org/mozilla-central/rev/092bc4ac84dc
https://hg.mozilla.org/mozilla-central/rev/8bdac5eedf78
https://hg.mozilla.org/mozilla-central/rev/7b7819250f79
https://hg.mozilla.org/mozilla-central/rev/790fd8710dd7
https://hg.mozilla.org/mozilla-central/rev/878722e87e62
https://hg.mozilla.org/mozilla-central/rev/451508713a62
https://hg.mozilla.org/mozilla-central/rev/630d78315203
Updated•4 years ago
|
Description
•