Граф коммитов

7183 Коммитов

Автор SHA1 Сообщение Дата
Gerald Squelart 4326b92ea7 Bug 1784812 - Use common JSONWriteFuncs when writing to a string - r=canaltinova,media-playback-reviewers,alwu
Most users of JSONWriter want to fill a string, so instead of having all these
similar implementations, we now have central reusable implementations:
- JSONStringWriteFunc contains a string and writes to it.
- JSONStringRefWriteFunc references a string and writes to it. This is most
  useful when the string already exists somewhere, or needs to be returned from
  a function (so we avoid another conversion when returning).

Differential Revision: https://phabricator.services.mozilla.com/D154618
2022-08-17 07:07:54 +00:00
Gerald Squelart 24798f281f Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-17 07:07:53 +00:00
Iulian Moraru 859487ba6b Backed out 4 changesets (bug 1784812) for causing build bustages on DDMediaLogs. CLOSED TREE
Backed out changeset c9998c927079 (bug 1784812)
Backed out changeset d2568bc2f8a6 (bug 1784812)
Backed out changeset 9f01bf89c583 (bug 1784812)
Backed out changeset d8506496d8f2 (bug 1784812)
2022-08-17 05:48:36 +03:00
Gerald Squelart 253bb5dc48 Bug 1784812 - Use common JSONWriteFuncs when writing to a string - r=canaltinova,media-playback-reviewers,alwu
Most users of JSONWriter want to fill a string, so instead of having all these
similar implementations, we now have central reusable implementations:
- JSONStringWriteFunc contains a string and writes to it.
- JSONStringRefWriteFunc references a string and writes to it. This is most
  useful when the string already exists somewhere, or needs to be returned from
  a function (so we avoid another conversion when returning).

Depends on D154617

Differential Revision: https://phabricator.services.mozilla.com/D154618
2022-08-16 22:57:49 +00:00
Gerald Squelart 68a8dee9cc Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-16 22:57:48 +00:00
Norisz Fay fd1720100c Backed out 3 changesets (bug 1658072) as they are related to previously backed out changeset CLOSED TREE
Backed out changeset 199d3ecfe13c (bug 1658072)
Backed out changeset a942be3d053d (bug 1658072)
Backed out changeset e0e98ee85f98 (bug 1658072)
2022-08-11 02:01:04 +03:00
Norisz Fay 936d025f11 Backed out changeset aaff4b4fd82e (bug 1658072) for causing xpcshell failures on process_watcher_posix_sigchld.cc CLOSED TREE 2022-08-11 01:56:09 +03:00
Jed Davis 30a7fec563 Bug 1658072 - Cleanup: assert that libevent's signal handling code is never used. r=nika
Given that libevent's signal handling code is known to have race
conditions, and there are fundamental issues that make it hard to fix
upstream, and previous patches have removed our last usage of it, we
should assert that it's no longer used.

Differential Revision: https://phabricator.services.mozilla.com/D141312
2022-08-10 21:25:49 +00:00
Jed Davis 1dc9df1d11 Bug 1658072 - Cleanup: remove the signal handling glue in the IPC event loop. r=nika
Now that we're no longer using libevent's signal handling, we don't need
an OO wrapper for it.

Differential Revision: https://phabricator.services.mozilla.com/D141311
2022-08-10 21:25:49 +00:00
Jed Davis fd0bcff6e5 Bug 1658072 - Cleanup: remove the now-dead DidProcessCrash function. r=nika
The function DidProcessCrash is now dead code.  Before the ProcessWatcher
rewrite, its return value (i.e., whether the process crashed) was never
used, so effectively its only purpose was to make it harder to understand
where the waitpid calls were happening.

Differential Revision: https://phabricator.services.mozilla.com/D141310
2022-08-10 21:25:48 +00:00
Jed Davis 6aee29c7dd Bug 1658072 - Rewrite the Unix implementation of IPC process termination handling. r=nika
This patch rewrites the Unix backend of ProcessWatcher for two reasons:

1. To remove the use of libevent's signal handling, which has concurrency
   bugs that can't be easily fixed upstream (see Bugzilla for details)

2. To simplify the code in general; in particular, the new version has one
   place where the process and its exit status are consumed from the OS

The new implementation uses the same pipe-to-self technique as libevent
(and which we use elsewhere) to deal with async signal safety.  Unlike
the previous version, there is a single object which manages all
monitored child processes rather than one each.  (Previously, this
multiplexing was done inside libevent.)

Differential Revision: https://phabricator.services.mozilla.com/D141309
2022-08-10 21:01:32 +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
Nika Layzell 45397cbfdd Bug 1779792 - Part 4: Deduplicate ProcessChild subclass constructors, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,alwu,mccr8
These constructors are unnecessary and can be defined with a `using` statement,
making it easier to change all constructors simultaneously.

Differential Revision: https://phabricator.services.mozilla.com/D153620
2022-08-10 14:55:23 +00:00
Nika Layzell 2ac29a461a Bug 1779792 - Part 3: Use an endpoint to bind the initial actor in parent processes, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,alwu,mccr8
This improves consistency with the child process case, and will make it easier
to attach additional state without needing to thread it through every child
process callsite manually.

Differential Revision: https://phabricator.services.mozilla.com/D153619
2022-08-10 14:55:22 +00:00
Nika Layzell d45df271ec Bug 1779792 - Part 2: Use an Endpoint to bind the initial actor in child processes, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,mccr8,alwu
This type is also used in other places to start non-initial actors, and will
allow us to attach additional state more easily without needing to thread it
through every child process callsite manually.

Differential Revision: https://phabricator.services.mozilla.com/D153618
2022-08-10 14:55:22 +00:00
Nika Layzell 263b5e445b Bug 1779792 - Part 1: Use cached value for log ID generation, r=mccr8
Previously this code read the atomic rather than the cached value (which
was unused). This is inherently racy as the atomic is updated on a
different thread than the read happened on.

Differential Revision: https://phabricator.services.mozilla.com/D153617
2022-08-10 14:55:21 +00:00
Mike Hommey d029bcdd7e Bug 1782988 - Avoid build bustage when building against glibc 2.36 or newer. r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D153716
2022-08-09 20:42:44 +00:00
Jed Davis 996eb87d1d Bug 1276388 - Use IPC process launching for Subprocess.jsm on Unix. r=kmag,nika,barret
Currently, Subprocess.jsm on Unix uses js-ctypes to call `posix_spawn`.
This has some issues, primarily that file descriptors are inherited by
the child process unless explicitly opted-out, which unfortunately a lot
of code doesn't do.  This patch changes it to use IPC process launching,
where fd inheritance is opt-in, by:

1. Extending `base::LaunchApp` to handle a few features that Subprocess
   needs (setting the process's working directory, specifying the full
   environment, and the macOS `disclaim` flag)

2. Adding a WebIDL method to `IOUtils` to expose that function to JS
   (currently Unix-only; Windows could also be supported but it would
   probably want to use a different IDL type for strings, given that the
   OS APIs use 16-bit code units).

3. Replacing the part of Subprocess that invokes `posix_spawn` (and
   related functions) by calling that method; the rest of Subprocess's
   machinery to manage pipes and I/O is unchanged.  (The Windows backend
   is also unchanged; I'm not aware of any functional issues there.)
   This results in some dead code, which is removed.

Differential Revision: https://phabricator.services.mozilla.com/D152336
2022-08-09 17:32:22 +00:00
Bob Owen 3dd8f8e969 Bug 1782199: Unregister the WER runtime module before returning from main. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D153728
2022-08-08 12:05:00 +00:00
Jim Blandy 7cc4f55f2a Bug 1782871: Correct IPDL documentation in 'Actor Lifetimes in C++' r=nika
Differential Revision: https://phabricator.services.mozilla.com/D153553
2022-08-03 21:32:36 +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
Mark Banner 7428be4a86 Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +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
Marian-Vasile Laza 0bebd4fea4 Backed out 4 changesets (bug 1781129) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 8557305bcd46 (bug 1781129)
Backed out changeset df6f98df9559 (bug 1781129)
Backed out changeset 905393f66985 (bug 1781129)
Backed out changeset 0d0f19a4db70 (bug 1781129)
2022-08-02 23:29:56 +03:00
Nika Layzell 23e8080029 Bug 1781129 - Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld
Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with `using`. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the `AllocShmem` method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Differential Revision: https://phabricator.services.mozilla.com/D151855
2022-08-02 18:09:41 +00:00
Marian-Vasile Laza 00079e8784 Backed out 4 changesets (bug 1781129) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 4a92d58726aa (bug 1781129)
Backed out changeset bce3f99441c0 (bug 1781129)
Backed out changeset fc135243503e (bug 1781129)
Backed out changeset 726458f976ff (bug 1781129)
2022-08-02 20:32:01 +03:00
Nika Layzell 536fd91345 Bug 1781129 - Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld
Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with `using`. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the `AllocShmem` method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Differential Revision: https://phabricator.services.mozilla.com/D151855
2022-08-02 17:15:42 +00:00
Jens Stutte 3ca1fb43c7 Bug 1777198 - Cancel content JS execution on quit-application-granted or on normal content process shutdown. r=smaug
We want to signal content processes to cancel content JS unconditionally on shutdown.
In the case of parent shutdown this has to happen as early as "quit-application-granted", given that both extensions and session storage shutdown rely on the possibility to interact with content processes (which is not possible when they are inside long running JS).
In addition in the case of a normal child shutdown we cancel content JS execution, too.
For now we put this behind the pref "dom.abort_script_on_child_shutdown" which remains default off.

Depends on D150539

Differential Revision: https://phabricator.services.mozilla.com/D150598
2022-08-02 14:02:40 +00:00
Sandor Molnar 646227cd7d Backed out 2 changesets (bug 1777198) for causing build bustage in dom/ipc/ProcessHangMonitor.cpp CLOSED TREE
Backed out changeset 472fe2d7af01 (bug 1777198)
Backed out changeset 0b9cb5b44360 (bug 1777198)
2022-08-02 14:08:45 +03:00
Bob Owen f29f23d58b Bug 1682520 p2: Register the WER Runtime Exception Module very early in process start up. r=gsvelto,glandium
Depends on D152198

Differential Revision: https://phabricator.services.mozilla.com/D152199
2022-08-02 10:41:14 +00:00
Bob Owen d6333678d8 Bug 1682520 p1: Move GeckoProcessType and implementation of get and set into mozglue. r=glandium
This means we can set and use the process type earlier in process startup.

Differential Revision: https://phabricator.services.mozilla.com/D152198
2022-08-02 10:41:14 +00:00
Jens Stutte f9302b34cc Bug 1777198 - Cancel content JS execution on quit-application-granted or on normal content process shutdown. r=smaug
We want to signal content processes to cancel content JS unconditionally on shutdown.
In the case of parent shutdown this has to happen as early as "quit-application-granted", given that both extensions and session storage shutdown rely on the possibility to interact with content processes (which is not possible when they are inside long running JS).
In addition in the case of a normal child shutdown we cancel content JS execution, too.
For now we put this behind the pref "dom.abort_script_on_child_shutdown" which remains default off.

Depends on D150539

Differential Revision: https://phabricator.services.mozilla.com/D150598
2022-08-02 09:08:23 +00:00
Chris Peterson c477304353 Bug 1782337 - Remove unused LineWatcher. r=ipc-reviewers,jld
Differential Revision: https://phabricator.services.mozilla.com/D153304
2022-08-02 04:58:07 +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
Emilio Cobos Álvarez 799aa83946 Bug 1775062 - Implement ipdl union operator= by using move/copy constructors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D149742
2022-08-01 06:03:01 +00:00
Cristian Tuns 85e845a6dc Backed out 2 changesets (bug 1682520) for causing build bustages on ProcessType.h CLOSED TREE
Backed out changeset 679e19334225 (bug 1682520)
Backed out changeset dad72c7e0d7b (bug 1682520)
2022-07-29 17:04:49 -04:00
Bob Owen edb40ba976 Bug 1682520 p2: Register the WER Runtime Exception Module very early in process start up. r=gsvelto,glandium
Depends on D152198

Differential Revision: https://phabricator.services.mozilla.com/D152199
2022-07-29 18:10:54 +00:00
Bob Owen cf59d0973b Bug 1682520 p1: Move GeckoProcessType and implementation of get and set into separate files. r=glandium
This means we can include these files in other binaries when we need earlier
access to the process type and use consistent code.

Differential Revision: https://phabricator.services.mozilla.com/D152198
2022-07-29 18:10:53 +00:00
Jed Davis 501b8ffcd7 Bug 1780312 - Turn off the Linux nvidia driver's shader cache in the RDD process. r=gcp
We were already turning off Mesa's shader cache in the RDD process,
because it's not useful given that we're only using video codec
acceleration and moving images around, and it does a few things related
to trying to access the cache that the sandbox would have to accomodate.

This patch does the equivalent thing for the nvidia proprietary driver;
we don't support it for media codec acceleration, but it can still be
loaded in that process (e.g., on multi-GPU systems) and it's trying to
call `statfs` on startup which may be related.

Differential Revision: https://phabricator.services.mozilla.com/D152932
2022-07-28 19:07:30 +00:00
Sean Feng 288cbe9f46 Bug 1778492 - Add an origin trial for coep: credentialless r=emilio,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D151381
2022-07-27 20:33:19 +00:00
Jim Blandy 610404dcde Bug 1779829: Replace `Shmem::PrivateIPDLCaller` with `friend` specifiers. r=nika
Instead of using the public member type `PrivateIPDLCaller` to
restrict access to certain `Shmem` member functions, make them
`private`, and designated `IProtocol` and `ITopLevelProtocol` as
friends of `Shmem`.

Differential Revision: https://phabricator.services.mozilla.com/D151952
2022-07-27 19:13:02 +00:00
Nika Layzell a8e8878706 Bug 1681359 - Part 2: Basic tests for BigBuffer, r=jld
Depends on D151851

Differential Revision: https://phabricator.services.mozilla.com/D152703
2022-07-26 20:51:25 +00:00
Nika Layzell 005eab77f7 Bug 1681359 - Part 1: Introduce the BigBuffer type to IPC, r=ipc-reviewers,jld
This type is inspired by the Chromium BigBuffer type, and acts as a type which
intelligently either allocates a shared memory region or in-memory buffer based
on the size of the payload. The current threshold is 64k bytes, and it can be
somewhat cheaply transferred over IPC.

This is intended to be used in places where we currently create a basic `Shmem`
to transfer a potentially large block of bytes over IPC.

Differential Revision: https://phabricator.services.mozilla.com/D151851
2022-07-26 20:51:25 +00:00
Marian-Vasile Laza 2ab97e789a Backed out 2 changesets (bug 1778492) for causing eslint failures.
Backed out changeset 6c3ac3569d31 (bug 1778492)
Backed out changeset 34227495753a (bug 1778492)
2022-07-26 17:43:53 +03:00
Sean Feng 38f70ee5fc Bug 1778492 - Add an origin trial for coep: credentialless r=emilio,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D151381
2022-07-26 14:06:04 +00:00
Emilio Cobos Álvarez 42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
az 534707da03 Bug 1766307 - Enable PDMFactory::Supports/SupportsMimeType to process+return HW/SW decode info r=media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D147385
2022-07-22 23:08:08 +00:00