Commit Graph

1788 Commits

Author SHA1 Message Date
Nika Layzell
573c3f5a9d Bug 1928734 - Part 2: Centralize handling of the IPC IO thread, r=ipc-reviewers,media-playback-reviewers,karlt,jld,handyman
Previously the handling for the IO thread was split between
BrowserProcessSubThread (a replication of the background thread infrastructure
used by Chromium during the IPC import, which is only used for the IO thread in
Gecko), and IOThreadChild (a wrapper around ChildThread, which was imported
from Chromium's source).

This meant that there was little code-sharing between the parent and child
processes, and that the lifecycle of the IO thread was perhaps less clear.

This refactors the code to centralize handling of these threads, and provide a
basic common interface. At the moment, actually hooking up async IO listeners
is still done using the Chromium interfaces.

Differential Revision: https://phabricator.services.mozilla.com/D227739
2024-11-19 18:34:02 +00:00
Butkovits Atila
836e13f637 Backed out 3 changesets (bug 1928734) for causing linting failure. CLOSED TREE
Backed out changeset 1b9e50c4c129 (bug 1928734)
Backed out changeset dd5cabd3fbc4 (bug 1928734)
Backed out changeset a9f66c1d560d (bug 1928734)
2024-11-19 01:49:22 +02:00
Nika Layzell
42cf063288 Bug 1928734 - Part 2: Centralize handling of the IPC IO thread, r=ipc-reviewers,media-playback-reviewers,karlt,jld
Previously the handling for the IO thread was split between
BrowserProcessSubThread (a replication of the background thread infrastructure
used by Chromium during the IPC import, which is only used for the IO thread in
Gecko), and IOThreadChild (a wrapper around ChildThread, which was imported
from Chromium's source).

This meant that there was little code-sharing between the parent and child
processes, and that the lifecycle of the IO thread was perhaps less clear.

This refactors the code to centralize handling of these threads, and provide a
basic common interface. At the moment, actually hooking up async IO listeners
is still done using the Chromium interfaces.

Differential Revision: https://phabricator.services.mozilla.com/D227739
2024-11-18 22:54:54 +00:00
Nika Layzell
a0a1368599 Bug 1927476 - Part 2: Reduce generated code for IPDL async reply handling, r=ipc-reviewers,mccr8
There was an installer size regression for macOS after the previous
change. I vaguely expect that this was in part caused by moving blocks
of duplicate IPDL serialization/deserialization logic into callback
lambdas, rather than in the larger OnMessageReceived handler function,
potentially leading to less code deduplication.

This patch moves the common parts of the IPDL message deserialization,
for the parts of the message which were serialized by IPDLResolverInner,
into the IPDLAsyncReturnsCallback class.

As a side-effect of this change, things like IPDL message ID validation
and reject case handling has also been moved to generic rather than
generated code.

Differential Revision: https://phabricator.services.mozilla.com/D228099
2024-11-06 18:36:33 +00:00
Sylvestre Ledru
cd289bcb06 Bug 1921433 - reformat with black 24.8.0 r=linter-reviewers,webdriver-reviewers,perftest-reviewers,taskgraph-reviewers,releng-reviewers,dom-storage-reviewers,janv,jmaher,whimboo,afinder,ahal
Differential Revision: https://phabricator.services.mozilla.com/D223963
2024-11-03 20:28:59 +00:00
serge-sans-paille
8a0a0f7524 Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato
MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-30 11:05:24 +00:00
Greg Stoll
c12829c03e Bug 1915351 part 3 - add entry point to get all clipboard to actor r=dlp-reviewers,ipc-reviewers,nika,edgar,handyman
Add an entry point to ClipboardContentAnalysisParent to get all the
data on the clipboard, which also analyzes all the clipboard contents.

Differential Revision: https://phabricator.services.mozilla.com/D223412
2024-10-28 22:37:57 +00:00
Greg Stoll
2b56bf1bac Bug 1879401 - Make clipboard DataTransfer use sync version of nsIAsyncGetClipboardData r=edgar,ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D224843
2024-10-28 22:37:56 +00:00
Alexandru Marc
ce4ccf3692 Backed out 10 changesets (bug 1879401, bug 1915351) for causing multiple regressions. CLOSED TREE
Backed out changeset 574d567bbbf1 (bug 1915351)
Backed out changeset 4fcb7eea243f (bug 1915351)
Backed out changeset aa0e2ce8cf21 (bug 1915351)
Backed out changeset 1cf3847d73a7 (bug 1915351)
Backed out changeset fba6942240ea (bug 1915351)
Backed out changeset c5279472391f (bug 1915351)
Backed out changeset a20adf8d4516 (bug 1915351)
Backed out changeset 2b900eb520ce (bug 1915351)
Backed out changeset a8b2b1f62ae6 (bug 1915351)
Backed out changeset 989b843531f8 (bug 1879401)
2024-10-25 16:43:29 +03:00
Greg Stoll
84529f2677 Bug 1915351 part 3 - add entry point to get all clipboard to actor r=dlp-reviewers,ipc-reviewers,nika,edgar,handyman
Add an entry point to ClipboardContentAnalysisParent to get all the
data on the clipboard, which also analyzes all the clipboard contents.

Differential Revision: https://phabricator.services.mozilla.com/D223412
2024-10-24 02:15:13 +00:00
Greg Stoll
ba664894f9 Bug 1879401 - Make clipboard DataTransfer use sync version of nsIAsyncGetClipboardData r=edgar,ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D224843
2024-10-24 02:15:11 +00:00
Andrew Osmond
c19fc820c4 Bug 1925024 - Rework shmem management with GMP video encoder/decoder. r=ipc-reviewers,media-playback-reviewers,nika,padenot
This patch makes it so that we pass along the necessary buffers as we go
along with encoding/decoding. This should increase shmem reuse, avoid
sync IPDL calls and reduce the overall complexity for buffer management.

Differential Revision: https://phabricator.services.mozilla.com/D226272
2024-10-22 14:20:48 +00:00
Nika Layzell
7364a10957 Bug 1925397 - Move async replies response ownership out of MessageChannel, r=ipc-reviewers,mccr8
This reduces the amount of casting required during async replies checks,
and ensures that the lifetimes of async replies callbacks are directly
tied to IPDL actor lifetimes.

This change does lose the unresolved-ipc-responses nsIMemoryReporter
implementation, as they are no longer stored as centrally.

Differential Revision: https://phabricator.services.mozilla.com/D226061
2024-10-21 19:16:24 +00:00
Bob Owen
d69a66f0fc Bug 1920463 p1: Remove RemoteSandboxBroker. r=nika,geckoview-reviewers,ipc-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D223114
2024-10-16 07:49:24 +00:00
Stanca Serban
df8d0bf1e7 Backed out 2 changesets (bug 1920463) for causing multiple failures. CLOSED TREE
Backed out changeset e56421ffea4f (bug 1920463)
Backed out changeset 3c3f9787cfe4 (bug 1920463)
2024-10-08 15:17:36 +03:00
Bob Owen
30ddc829b4 Bug 1920463 p1: Remove RemoteSandboxBroker. r=nika,geckoview-reviewers,ipc-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D223114
2024-10-08 09:57:56 +00:00
Nika Layzell
fd1d20ea4b Bug 1440207 - Part 3d: Pass the initial IPC pipe using geckoargs, r=ipc-reviewers,mccr8
The initial IPC pipe was previously the only argument passed as a chromium
command line flag. This changes it to instead be passed using geckoargs,
unifying the platforms, and removing the need for specific handling on every
platform.

Differential Revision: https://phabricator.services.mozilla.com/D221374
2024-10-01 22:21:49 +00:00
Nika Layzell
c3974e5fe9 Bug 1440207 - Part 3a: Migrate GeckoChildProcessHost callers to use ChildProcessArgs, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,aosmond,mccr8
This patch implements the majority of the public interface for the new IPC
handle passing design.

The rough design is an expansion of `geckoargs` to allow passing
`UniqueFileHandle` arguments to child processes. This replaces the existing
extra options array to make the list of files explicit.

This currently just replaces things which were already passed this way on the
command line from outside of GeckoChildProcessHost. Note that this does not
migrate callers which were not already passing file handles using geckoargs,
and does not implement the actual OS-level support for passing arguments this
way.

Differential Revision: https://phabricator.services.mozilla.com/D221371
2024-10-01 22:21:47 +00:00
Cristian Tuns
44fb28a14e Backed out 13 changesets (bug 1440207) for causing multiple failures. CLOSED TREE
Backed out changeset c9f33dfc1cc5 (bug 1440207)
Backed out changeset 76d823a34925 (bug 1440207)
Backed out changeset 75a99142ee1c (bug 1440207)
Backed out changeset b4d283d3e8da (bug 1440207)
Backed out changeset ea81a08ce181 (bug 1440207)
Backed out changeset c581a4e8cd15 (bug 1440207)
Backed out changeset d13799a1dc26 (bug 1440207)
Backed out changeset 6d715586c911 (bug 1440207)
Backed out changeset 30ff6a4db1d0 (bug 1440207)
Backed out changeset 2da0bbfdfee5 (bug 1440207)
Backed out changeset f3445c3fdd5e (bug 1440207)
Backed out changeset 07fbed499fe4 (bug 1440207)
Backed out changeset 1c2ac609c466 (bug 1440207)
2024-09-24 19:10:35 -04:00
Nika Layzell
d8e8ad3784 Bug 1440207 - Part 3d: Pass the initial IPC pipe using geckoargs, r=ipc-reviewers,mccr8
The initial IPC pipe was previously the only argument passed as a chromium
command line flag. This changes it to instead be passed using geckoargs,
unifying the platforms, and removing the need for specific handling on every
platform.

Differential Revision: https://phabricator.services.mozilla.com/D221374
2024-09-24 19:28:10 +00:00
Nika Layzell
8698f6c068 Bug 1440207 - Part 3a: Migrate GeckoChildProcessHost callers to use ChildProcessArgs, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,aosmond,mccr8
This patch implements the majority of the public interface for the new IPC
handle passing design.

The rough design is an expansion of `geckoargs` to allow passing
`UniqueFileHandle` arguments to child processes. This replaces the existing
extra options array to make the list of files explicit.

This currently just replaces things which were already passed this way on the
command line from outside of GeckoChildProcessHost. Note that this does not
migrate callers which were not already passing file handles using geckoargs,
and does not implement the actual OS-level support for passing arguments this
way.

Differential Revision: https://phabricator.services.mozilla.com/D221371
2024-09-24 19:28:09 +00:00
Nika Layzell
bdb401316d Bug 1908725 - Part 2: Make the ChildID available in the same places as OtherPid, r=ipc-reviewers,media-playback-reviewers,win-reviewers,alwu,rkraesig,gfx-reviewers,mccr8,nical
This requires quite a bit of piping to get the ChildID passed everywhere where
we currently pass the pid in IPC. This is done by adding a new struct type
(EndpointProcInfo), which is passed around instead of OtherPid in these places,
and contains the full pid.

In most cases, it was a fairly painless change to move over, however in some
cases, more complex changes were required, as the pid was being stored
previously in something like an Atomic<...>, and needed to be switched to using
a mutex-protected value.

In the future, it may be possible to remove OtherPid from IPDL actors once
everything is migrated to ChildID, but we're still a long way off from that, so
for now we unfortunately need to pass both around.

Differential Revision: https://phabricator.services.mozilla.com/D217118
2024-08-07 20:39:39 +00:00
Nika Layzell
1ee5073e80 Bug 1907412 - Stop using AlignedStorage in IPDL unions, r=ipc-reviewers,mccr8
In more recent versions of C++, it is possible to declare a C union with
non-POD members, so long as there is an explicit destructor/constructor
responsible for managing the members.

This patch switches to using the variant types directly within the
union, rather than using AlignedStorage to store inline members. This
requires some tweaks to how the union is declared (specifically, it must
be an anonymous inline union so that it shares the main union type's
constructor/destructor, otherwise explicit ctors/dtors would need to be
declared for the bare union type).

Overall, this change should make no functional difference.

Differential Revision: https://phabricator.services.mozilla.com/D216329
2024-07-15 21:33:37 +00:00
Greg Stoll
6ba11a66b8 Bug 1901197: do synchronous Content Analysis for clipboard operations on a background thread r=dlp-reviewers,ipc-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D215457
2024-07-04 01:24:53 +00:00
Christian Holler (:decoder)
e0ae53527b Bug 1896638 - Export some IPDL information as JSON. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D210326
2024-06-07 10:22:48 +00:00
Nika Layzell
20ef7e892a Bug 1895358 - Part 2: Handle ManagedContainer membership more centrally, r=ipc-reviewers,mccr8
This patch adjusts ManagedContainer to have a common base class, and exposes
methods for interacting with this base class from generic code on IProtocol.
This avoids the need for some specialized methods which were previously
required in order to manipulate the managed lists which allows the ordering to
be more precisely controlled in generic actor lifecycle methods.

Differential Revision: https://phabricator.services.mozilla.com/D209855
2024-05-15 20:36:28 +00:00
Nika Layzell
4388b2bf77 Bug 1895358 - Part 1: Improve formatting of long multiline argument lists, r=ipc-reviewers,mccr8
This changes the way that StmtCode handles the pattern `$,{list}` alone on a
line, adjusting it such that each item on the list is printed onto its own
line, and then indented. This helps the formatting of large lists such as the
ones generated in part 2.

Differential Revision: https://phabricator.services.mozilla.com/D209854
2024-05-15 20:36:28 +00:00
serge-sans-paille
967c226657 Bug 1890817 - Run ipdl.py in distributed r=nika
Slightly restructure the script to be compatible with multiprocessing,
but in a non-intrusive way: guard execution by __main__ and use shared
containers for shared states.

Avoid a redundant parser call (even if cached).

Differential Revision: https://phabricator.services.mozilla.com/D207180
2024-05-03 08:08:07 +00:00
Nika Layzell
d1d7554feb Bug 1893087 - Part 2: Add test for constructing an actor under an already dead manager, r=ipc-reviewers,mccr8
Depends on D208936

Differential Revision: https://phabricator.services.mozilla.com/D209053
2024-04-30 21:27:34 +00:00
Nika Layzell
039cb74465 Bug 1893087 - Part 1: Relax assertion in RemoveManagee, r=ipc-reviewers,mccr8
With the new changes in bug 1724083, it is possible for an actor to be
destroyed during SetManagerAndRegister, which can lead to RemoveManagee being
called before the managee is even registered, leading to an assertion failure.
The easiest fix here is to relax this assertion, as we won't insert the entry
later in this failure case.

Differential Revision: https://phabricator.services.mozilla.com/D208936
2024-04-30 21:27:33 +00:00
Nika Layzell
3aed03b1c5 Bug 1724083 - Part 3: Add a test to ensure IPDL actors handle reentrant destruction, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D206797
2024-04-22 17:31:06 +00:00
Nika Layzell
9ee77f6ae1 Bug 1724083 - Part 1: Rework ActorDestroy logic to be more resilient to nested event loops, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D198840
2024-04-22 17:31:06 +00:00
serge-sans-paille
f14b76b090 Bug 1890722 - Correctly track generation of ipdl files r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D207115
2024-04-16 06:52:32 +00:00
Andrew McCreight
07a82f8cc7 Bug 1888936 - Fix two issues with UniquePtr in IPDL. r=ipc-reviewers,nika
The IPDL union name needs to be a valid C++ identifier.

We need to look inside a UniquePtr to find type dependencies.

Differential Revision: https://phabricator.services.mozilla.com/D206259
2024-04-01 19:50:57 +00:00
Kelsey Gilbert
666d6cb34e Bug 1886214 - Cache PWebGL::IsEnabled. r=gfx-reviewers,lsalzman,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D205091
2024-03-21 17:37:41 +00:00
Alex
7f8d271a8c Bug 1886471 - Fix racy TestHangsHang test r=ipc-reviewers,nika
This is very likely to address the cause of the intermittent failure.

Differential Revision: https://phabricator.services.mozilla.com/D205246
2024-03-21 14:20:45 +00:00
Barret Rennie
81a6b069cf Bug 1885948 - Pass IPDL sources to ipdl.py in a text file r=nika,ahochheiden
If the path to your source checkout on Windows is sufficiently long enough, you
can hit the Windows maximum commandline argument limit (32k) specifying IPDL
files to ipdl.py during build. Writing the list of files to a file and passing
that to ipdl.py gets around this error completely.

Differential Revision: https://phabricator.services.mozilla.com/D204949
2024-03-20 14:58:53 +00:00
Alex
64550316b7 Bug 1729044 - Remove ipdl support for intr r=ipc-reviewers,nika
This removes intr support and updates some stale docs as well.

It's not immediately clear what code in MessageChannel can be removed,
though I expect some things could be simplified (there's just not much
alluding to intr/rpc/urgent).

Differential Revision: https://phabricator.services.mozilla.com/D204813
2024-03-20 14:28:15 +00:00
Alex
f50b261d13 Bug 1746288 - Remove intr from IPDL tests r=ipc-reviewers,nika
Some tests had `intr` as a means of having the most restricted protocol
type; those were downgraded to `sync`.

Differential Revision: https://phabricator.services.mozilla.com/D204783
2024-03-19 13:21:15 +00:00
Natalia Csoregi
a1e84a49ec Backed out changeset a1428617e87a (bug 1885948) for causing mbu failures. CLOSED TREE 2024-03-19 07:50:34 +02:00
Barret Rennie
541f3fc622 Bug 1885948 - Pass IPDL sources to ipdl.py in a text file r=nika,ahochheiden
If the path to your source checkout on Windows is sufficiently long enough, you
can hit the Windows maximum commandline argument limit (32k) specifying IPDL
files to ipdl.py during build. Writing the list of files to a file and passing
that to ipdl.py gets around this error completely.

Differential Revision: https://phabricator.services.mozilla.com/D204949
2024-03-18 20:03:13 +00:00
Iulian Moraru
39646463bc Backed out changeset 8a9b63318958 (bug 1729044) for causing linux build bustages. CLOSED TREE 2024-03-19 04:58:49 +02:00
Alex
28e7b97eeb Bug 1729044 - Remove ipdl support for intr r=ipc-reviewers,nika
This removes intr support and updates some stale docs as well.

It's not immediately clear what code in MessageChannel can be removed,
though I expect some things could be simplified (there's just not much
alluding to intr/rpc/urgent).

Differential Revision: https://phabricator.services.mozilla.com/D204813
2024-03-18 17:23:26 +00:00
Alex
6c8a0020a5 Bug 1236717 - Remove unused/unmigrated IPDL tests r=ipc-reviewers,nika
The tests we want to keep have been migrated to gtests and are run by
default.

Differential Revision: https://phabricator.services.mozilla.com/D204818
2024-03-18 17:12:25 +00:00
Alex
b9343c37c9 Bug 1885018 - Remove unnecessary generation code in the IPDL compiler r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204657
2024-03-15 15:10:33 +00:00
Alex
19fb5724a7 Bug 1885018 - Disallow sync and return values in destructors r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204656
2024-03-15 15:10:32 +00:00
Edgar Chen
fdaf5ca11a Bug 1858627 - Update DataTransfer to utilize GetDataSnapshotSync() for retrieving clipboard formats; r=nika,ipc-reviewers
The actual data retrieval continues to use the original method.

Differential Revision: https://phabricator.services.mozilla.com/D202351
2024-03-13 20:44:06 +00:00
Edgar Chen
239696f93b Bug 1858627 - Add nsIClipboard API to return nsIAsyncSetClipboardData synchrously; r=ipc-reviewers,nika
This is a sync version of `nsIClipboard.asyncGetData`, which can be used for
synchronous clipboard APIs, e.g. DataTransfer, to support the clipboard seqence
number concept, see bug 1879401.

Differential Revision: https://phabricator.services.mozilla.com/D201364
2024-03-13 20:44:06 +00:00
Alex Franchuk
1d4418517f Bug 1751995 - Remove TestUrgentHangs r=ipc-reviewers,nika
This seemed like a lot of effort to port with little gain, since it's testing sync/cpow message
things.

Differential Revision: https://phabricator.services.mozilla.com/D202265
2024-03-13 13:10:25 +00:00
Alex Franchuk
4733f46b7c Bug 1751995 - Migrate TestUrgency r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D202264
2024-03-13 13:10:25 +00:00