Commit graph

268 commits

Author SHA1 Message Date
Nika Layzell
c4a5d70ac5 Bug 1789440 - Track reply message IDs for MessageChannel async replies, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D156569
2022-09-07 23:38:45 +00:00
Noemi Erli
fc97f1f051 Backed out changeset 0f2c5cc743c8 (bug 1789440) for causing mass failures 2022-09-08 01:54:54 +03:00
Nika Layzell
17486aef5c Bug 1789440 - Track reply message IDs for MessageChannel async replies, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D156569
2022-09-07 20:30:39 +00:00
Nika Layzell
96d76af151 Bug 1779792 - Part 5: Add a unique nsID field to each MessageChannel pair, r=ipc-reviewers,mccr8
This won't be used for any security or routing purposes, but can be useful for
debugging. It will be used in the future by the profiler to correlate sent and
received message events across processes.

Differential Revision: https://phabricator.services.mozilla.com/D153621
2022-08-10 14:55:23 +00:00
Fabrice Desré
c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Christian Holler
53b78333a2 Bug 1782505 - Observe destroyed actors in IPC fuzzing. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D153344
2022-08-02 22:06:28 +00:00
Andreea Pavel
89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Jens Stutte
79586c0534 Bug 1775112 - Remove obsolete MessageChannel::Begin/StopPostponingSends feature. r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D149775
2022-06-21 06:18:31 +00:00
Nika Layzell
9f2d7d7379 Bug 1768775 - Stash mIsFuzzMsg on the MessageTask so it's available after the message is run, r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D146082
2022-05-11 14:15:35 +00:00
Nika Layzell
f6f488a296 Bug 1768476 - Part 2: Mark MessageTask::mMessage as guarded by the monitor, r=ipc-reviewers,mccr8
All accesses except those through the xpcom interfaces were already
guarded, and given it can be mutated, this seemed easier than adding
thread assertions or similar.

Differential Revision: https://phabricator.services.mozilla.com/D145886
2022-05-10 21:37:26 +00:00
Nika Layzell
ed88dc4370 Bug 1768476 - Part 1: Consistently pass IPC::Message around by UniquePtr, r=ipc-reviewers,mccr8
This makes passing around the type more consistent, and hopefully will make
changes to IPC::Message easier to work with in the future.

In addition, this should save us a few copies as we move the message type into
and out of UniquePtr, however I expect this won't make much of a difference.

Differential Revision: https://phabricator.services.mozilla.com/D145885
2022-05-10 21:37:25 +00:00
Noemi Erli
72d8a8554a Backed out 2 changesets (bug 1768476) for causing build bustages in ProtocolFuzzer.h
Backed out changeset c9cb03579c09 (bug 1768476)
Backed out changeset 6732ef394d0e (bug 1768476)
2022-05-10 23:39:29 +03:00
Nika Layzell
72106399dd Bug 1768476 - Part 2: Mark MessageTask::mMessage as guarded by the monitor, r=ipc-reviewers,mccr8
All accesses except those through the xpcom interfaces were already
guarded, and given it can be mutated, this seemed easier than adding
thread assertions or similar.

Differential Revision: https://phabricator.services.mozilla.com/D145886
2022-05-10 17:45:43 +00:00
Nika Layzell
edf2564dbc Bug 1768476 - Part 1: Consistently pass IPC::Message around by UniquePtr, r=ipc-reviewers,mccr8
This makes passing around the type more consistent, and hopefully will make
changes to IPC::Message easier to work with in the future.

In addition, this should save us a few copies as we move the message type into
and out of UniquePtr, however I expect this won't make much of a difference.

Differential Revision: https://phabricator.services.mozilla.com/D145885
2022-05-10 17:45:42 +00:00
Christian Holler
0ccdc33183 Bug 1756778 - Integrate top-level IPC fuzzing. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D139471
2022-05-05 15:39:24 +00:00
Nika Layzell
737bb9fe35 Bug 1738104 - Shutdown IPC actors during EventTarget shutdown, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D129841
2022-03-23 22:22:05 +00:00
Nika Layzell
6cd1233132 Bug 1760357 - Part 3: Add thread-safety annotations to MessageChannel, r=jesup
Like DataPipe, the Monitor in this case is shared between multiple objects and
needs some helper methods.

Theoretically REQUIRES annotations should be added to methods on the
transaction type, however the requirement would be difficult to express,
leading to a lot of assertion methods cluttering up the code, so it was left
out for now.

Differential Revision: https://phabricator.services.mozilla.com/D141534
2022-03-22 14:59:41 +00:00
Cristian Tuns
f22866f09c Backed out 5 changesets (bug 1760357) for causing build bustages on Monitor.h CLOSED TREE
Backed out changeset 799de364a32e (bug 1760357)
Backed out changeset 29957146468a (bug 1760357)
Backed out changeset e79cb8caca88 (bug 1760357)
Backed out changeset afba32f4da1d (bug 1760357)
Backed out changeset ddfc71cdf34e (bug 1760357)
2022-03-21 19:01:11 -04:00
Nika Layzell
2276f38241 Bug 1760357 - Part 3: Add thread-safety annotations to MessageChannel, r=jesup
Like DataPipe, the Monitor in this case is shared between multiple objects and
needs some helper methods.

Theoretically REQUIRES annotations should be added to methods on the
transaction type, however the requirement would be difficult to express,
leading to a lot of assertion methods cluttering up the code, so it was left
out for now.

Differential Revision: https://phabricator.services.mozilla.com/D141534
2022-03-21 21:05:59 +00:00
Nazım Can Altınova
7471bb6338 Bug 1758099 - Add the origin tid of the IPC markers if the thread is not being profiled r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D141100
2022-03-16 14:27:36 +00:00
Nika Layzell
0ae1cf31f9 Bug 1751948 - Part 5: Ensure we don't release ActorLifecycleProxy while holding MessageChannel's Monitor, r=jld
Releasing ActorLifecycleProxy can lead to the IToplevelProtocol being
destroyed, due to the reference being the last reference. If this happens, we
can deadlock due to the MessageChannel embedded in IToplevelProtocol locking
mMonitor during its' destructor. This patch moves acquiring the proxy earlier
in the method, so that we do not deadlock in this case any longer.

Differential Revision: https://phabricator.services.mozilla.com/D137169
2022-02-28 21:01:48 +00:00
Randell Jesup
04eee57501 Bug 1748759: ipc cleanup r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D135184
2022-02-10 22:01:17 +00:00
Nika Layzell
9919099425 Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-02-08 23:53:45 +00:00
Sandor Molnar
6035b5cf95 Backed out changeset ba6624225635 (bug 1738734) for causing build bustages in ipc/PUtilityProcessParent. 2022-02-01 00:57:12 +02:00
Nika Layzell
c45d6350d4 Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-01-31 22:26:05 +00:00
Nika Layzell
f17ea9075a Bug 1751047 - Remove support for intr messages from IPC, r=ipc-reviewers,mccr8
All uses of the intr message type have been removed from the tree, and the only
remaining uses are in IPDL tests, which currently do not test the IPDL runtime.
This test fully removes support for intr messages from the MessageChannel
interface.

Differential Revision: https://phabricator.services.mozilla.com/D136500
2022-01-27 16:42:13 +00:00
Nika Layzell
09d88e5fd2 Bug 1749059 - Remove Quantum DOM support from IPDL, r=ipc-reviewers,mccr8
This is no longer necessary as the Quantum DOM project is no longer
happening, and removing support simplifies various components inside of
IPDL.

As some code used the support to get a `nsISerialEventTarget` for an
actor's worker thread, that method was replaced with a method which
instead pulls the nsISerialEventTarget from the MessageChannel and
should work on all actors.

Differential Revision: https://phabricator.services.mozilla.com/D135411
2022-01-25 20:29:46 +00:00
Jens Stutte
ef05e1f955 Bug 1747380: Always include channel name and task name while reporting channel errors. r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D134613
2022-01-05 16:22:19 +00:00
Nika Layzell
4d227d94ae Bug 1725335 - Streamline ownership and locking in MessageTask, r=ipc-reviewers,mccr8
This simplifies the logic around MessageTask's lifecycle to make
ownership as clear as possible and reduce the number of redundant
checks.

This new change no longer clears the mChannel member when the
MessageTask is disconnected, instead relying on isInList() to check
whether the MessageTask is still in the channel's mPending list. This is
already being automatically managed as the mPending list is modified,
and should avoid potential usage mistakes.

Differential Revision: https://phabricator.services.mozilla.com/D123140
2021-09-01 15:26:54 +00:00
Nika Layzell
c705251ce8 Bug 1719577 - Part 8: Remove some unused methods from MessageChannel, r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D119356
2021-07-23 19:14:59 +00:00
Nika Layzell
639ed70cb4 Bug 1719577 - Part 6: More consistently use the monitor during MessageChannel shutdown, r=handyman
This should make the logic around clearing a MessageChannel more obviously
correct by holding the mutex when accessing fields which are traditionally
guarded by the mutex. These lock calls shouldn't introduce performance issues
as the lock should be uncontended.

Differential Revision: https://phabricator.services.mozilla.com/D119354
2021-07-23 19:14:58 +00:00
Nika Layzell
93f8303221 Bug 1719577 - Part 5: Remove the now-unused ChannelOpening state, r=handyman
This state was only used by the ProcessLink MessageLink implementation, and no
longer exists with the new PortLink implementation, so can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D119353
2021-07-23 19:14:58 +00:00
Nika Layzell
64fd825e97 Bug 1719577 - Part 3: Remove dead WaitForIncomingMessage function, r=handyman
This method is never called.

Differential Revision: https://phabricator.services.mozilla.com/D119351
2021-07-23 19:14:57 +00:00
Nika Layzell
0e37500335 Bug 1719577 - Part 2: Create mMonitor eagerly in MessageChannel's constructor, r=handyman
Now that PortLink is the only MessageLink implementation, it is no longer
necessary to support sharing a single `RefCountedMonitor` between multiple
MessageChannels, meaning that we can construct the monitor directly in the
`MessageChannel` constructor. The monitor still needs to be refcounted due to
being used by the PortLink as part of the listener implementation.

Differential Revision: https://phabricator.services.mozilla.com/D119350
2021-07-23 19:14:56 +00:00
Nika Layzell
488fc0d1be Bug 1719577 - Part 1: Use inline initializers for MessageChannel fields, r=handyman
This makes things generally more clear, and avoids a long list of initializers
in the MessageChannel constructor. In addition, some fields which are never
modified are marked as `const`.

Differential Revision: https://phabricator.services.mozilla.com/D119349
2021-07-23 19:14:56 +00:00
Nika Layzell
7ad5d70418 Bug 1718333 - Remove unnecessary AssertLinkThread assertions, r=handyman
After looking through the methods which have this assertion, I couldn't
find any examples of places where not having a specific "link thread"
sequence would cause any issues. I think these assertions can and should
be removed.

The main change required by this was to remove the `!NS_IsMainThread()`
assertion from the SchedulerGroup listener. Due to how callbacks work,
it would be possible for a vsync message to be detected by a
MessageChannel from the main thread if it was sent before the channel
was bound. I don't believe that this change should cause any issues.

Differential Revision: https://phabricator.services.mozilla.com/D119348
2021-07-15 21:09:55 +00:00
Florian Quèze
cd399a71a2 Bug 1717991 - Remove ifdefs around code that adds profiler markers with custom marker schemas, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D118680
2021-06-25 13:28:01 +00:00
Nika Layzell
5cc51fa13f Bug 1713148 - Part 5: Remove ThreadLink, r=handyman
This removes the last form of unique link between two MessageChannels so that
all MessageChannels communicate using PortLink, as it is fairly straightforward
to use PortLink to communicate between two threads in-process.

Differential Revision: https://phabricator.services.mozilla.com/D116672
2021-06-22 18:17:25 +00:00
Nika Layzell
7dba3a39f8 Bug 1713148 - Part 4: Remove ProcessLink, r=handyman
After the changes in part 3, this type is now dead code and can be fully
removed.

Differential Revision: https://phabricator.services.mozilla.com/D116671
2021-06-22 18:17:25 +00:00
Nika Layzell
985adb750c Bug 1706374 - Part 11: Add NodeController component bridging IPC and Ports, r=handyman
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.

Differential Revision: https://phabricator.services.mozilla.com/D112775
2021-06-22 18:17:22 +00:00
Nika Layzell
9ae1129462 Bug 1706374 - Part 10: Remove unnecessary IToplevelProtocol::OnChannelConnected, r=handyman,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D116665
2021-06-22 18:17:21 +00:00
Butkovits Atila
83f57b5c69 Backed out 22 changesets (bug 1714226, bug 1706374, bug 1713148) for causing build bustages on MessageChannel.cpp. CLOSED TREE
Backed out changeset ea469eaa54ca (bug 1713148)
Backed out changeset fd8523d5126e (bug 1713148)
Backed out changeset f2e5309c914c (bug 1713148)
Backed out changeset 2da57973ed55 (bug 1713148)
Backed out changeset 677e1ee99bb2 (bug 1713148)
Backed out changeset b4c0619e79bf (bug 1706374)
Backed out changeset c02fa459e77d (bug 1706374)
Backed out changeset 72dc6537cf0b (bug 1706374)
Backed out changeset 48088463c656 (bug 1706374)
Backed out changeset b09ae4c3a94b (bug 1706374)
Backed out changeset 04422175004b (bug 1706374)
Backed out changeset 110b2384e7d1 (bug 1706374)
Backed out changeset ab2b086abbd4 (bug 1706374)
Backed out changeset ffde07f73249 (bug 1706374)
Backed out changeset c6303af17ff4 (bug 1706374)
Backed out changeset 02249671c2f9 (bug 1706374)
Backed out changeset a6a5d05b5636 (bug 1706374)
Backed out changeset e21b6defb805 (bug 1706374)
Backed out changeset c72c5be9ddb1 (bug 1706374)
Backed out changeset 23cd961575a6 (bug 1706374)
Backed out changeset b412d6e9e145 (bug 1706374)
Backed out changeset a8ec285d6472 (bug 1714226)
2021-06-22 04:03:56 +03:00
Nika Layzell
8e8aa56ee2 Bug 1713148 - Part 5: Remove ThreadLink, r=handyman
This removes the last form of unique link between two MessageChannels so that
all MessageChannels communicate using PortLink, as it is fairly straightforward
to use PortLink to communicate between two threads in-process.

Differential Revision: https://phabricator.services.mozilla.com/D116672
2021-06-21 21:53:13 +00:00
Nika Layzell
03646b0682 Bug 1713148 - Part 4: Remove ProcessLink, r=handyman
After the changes in part 3, this type is now dead code and can be fully
removed.

Differential Revision: https://phabricator.services.mozilla.com/D116671
2021-06-21 21:53:13 +00:00
Nika Layzell
6de2add6d7 Bug 1706374 - Part 11: Add NodeController component bridging IPC and Ports, r=handyman
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.

Differential Revision: https://phabricator.services.mozilla.com/D112775
2021-06-21 21:53:10 +00:00
Nika Layzell
4a956a2673 Bug 1706374 - Part 10: Remove unnecessary IToplevelProtocol::OnChannelConnected, r=handyman,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D116665
2021-06-21 21:53:10 +00:00
Nika Layzell
bf27412e89 Bug 1563624 - Part 2: Automatically reject async IPC responses when the resolver is dropped, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D108868
2021-03-18 16:56:10 +00:00