WorkerPrivate's GlobalScope is created during CompileScriptRunnable::WorkerRun.
However, the creation could fail when there is an OOM issue during the WebIDL bindings.
Although the Worker will start the shutdown as soon as possible, there is still a chance that some WorkerRunnable had already been dispatched to the Worker. And there is no guarantee that there is a GlobalScope for the WorkerRunnable.
Unfortunately, WorkerRunnable should check the GlobalScope existence by itself, because not every WorkerRunnable needs the GlobalScope to perform its functionality.
This patch only does the null checking for the ServiceWorkerOpRunnable, since ServiceWorkerOpRunnable are supposed to dispatching an event to the corresponding ServiceWorkerGlobalScope.
Original Revision: https://phabricator.services.mozilla.com/D254659
Differential Revision: https://phabricator.services.mozilla.com/D258725
In modern C++, static constexpr member variables are automatically
inline (aka weak) so the template trick is not needed. This also avoid
duplication and reduces the amount of parsed code. No impact on
generated binary (actually: smaller debuginfo, close to identical
binary).
Differential Revision: https://phabricator.services.mozilla.com/D247825
This diff was generated as follows:
List all toml files in the tree:
`find * -name '*.toml' > /tmp/toml`
Manually edited /tmp/toml to drop non-relevant entries (objdir).
Ran the toml linter for all files:
`cat /tmp/toml | xargs ./mach lint -l test-manifest-toml --fix`
Differential Revision: https://phabricator.services.mozilla.com/D240948
Ensure that all async IPC calls made on ServiceWorkerRegistration (which
includes calls made on behalf of NavigationPreloadManager) hold a strong
reference to the ServiceWorkerRegistration for the duration of the async
IPC calls so that the ServiceWorkerRegistration is not cycle-collected
if the caller is only then-ing on the promise and has not retained a strong
reference to the ServiceWorkerRegistration.
This is accomplished by holding a strong self-reference in the IPC-resolved
callback.
In order to ensure that these strong references are properly cleaned up on
the main thread, we:
- Add a call to Shutdown during DisconnectFromOwner to shutdown IPC when the
global is being torn down.
- Modernize PServiceWorkerRegistration to allow the child to directly invoke
`Send__delete__` rather than having to ask the parent to call that method
via `SendTeardown`. This ensures the actor is destroyed in a more timely
fashion and generally makes things easier to reason about.
- Eliminate use of boolean flags that are redundant with what `CanSend()`
indicates (as long as we call it on the thread that owns the actor).
The Shutdown call isn't technically needed on the worker thread because worker
shutdown tears down PBackground and thereby all PServiceWorkerRegistration
instances, although these cleanups make that cleanup happen in a more timely
fashion. Additionally, ServiceWorkerRegistrationChild does use IPCWorkerRef
with the callback triggering eager shutdown of the actor on workers
(notify(Canceling) can occur prior to DisconnectFromOwner when the interrupt
is used), but the more notable impact is IPCWorkerRef causes the actor to
not be counted as something that should prevent GC of the worker (and these
changes do not alter that).
Differential Revision: https://phabricator.services.mozilla.com/D242885
To most directly run the tests, run:
```
./mach mochitest --headless -f plain --tag dom-serviceworkers-api-private dom/serviceworkers/test/
```
Differential Revision: https://phabricator.services.mozilla.com/D213733
Do this by populating a trivial `ExtTex` type in `ExternalTexture.h`. Do not use `ExternalTexture`, since that's currently used by the internals that actually implement interesting operations for external texture usage with WGPU; punt on figuring out the perfect name for later.
This allows many CTS tests, which use `x instanceof GPUExternalTexture` without actually consuming the external texture API, to make interesting forward progress.
This should be strictly safe to do, since we do not permit the user to actually construct or use a `GPUExternalTexture`.
Analysis of CTS outcome changes:
- New `PASS`es resulting in promotion to tier 2:
- `webgpu:shader,execution,expression,call,builtin,textureDimensions:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureDimensions:sampled_and_multisampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:*` on Windows and Linux
- `webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:*` on Windows and Linux
- `webgpu:shader,execution,expression,call,builtin,textureNumLayers:arrayed:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumLayers:sampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumSamples:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureNumSamples:sampled:*`
- `webgpu:shader,execution,expression,call,builtin,textureSample:sampled_1d_coords:*` on Windows and Linux
Otherwise are _many_ new `PASS`es in test variants that don't quite make entire test(s) pass, so this is definitely a good change. 🙂
- Some tests' variants have been deleted, since they are no longer reported due to _all_ runs of them `CRASH`ing due to timeout (rather than a stack crash). This will be dealt with in follow-up work. Since these tests are in tier 3, I don't see a hard problem with letting these be deleted for now.
Differential Revision: https://phabricator.services.mozilla.com/D240673
Do this by populating a trivial `ExtTex` type in `ExternalTexture.h`. Do not use `ExternalTexture`, since that's currently used by the internals that actually implement interesting operations for external texture usage with WGPU; punt on figuring out the perfect name for later.
This allows many CTS tests, which use `x instanceof GPUExternalTexture` without actually consuming the external texture API, to make interesting forward progress.
This should be strictly safe to do, since we do not permit the user to actually construct or use a `GPUExternalTexture`.
Analysis of CTS outcome changes:
- New `PASS`es resulting in promotion to tier 2:
- `webgpu:shader,execution,expression,call,builtin,textureDimensions:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureDimensions:sampled_and_multisampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:*` on Windows and Linux
- `webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:*` on Windows and Linux
- `webgpu:shader,execution,expression,call,builtin,textureNumLayers:arrayed:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumLayers:sampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:*` on Linux and macOS
- `webgpu:shader,execution,expression,call,builtin,textureNumSamples:depth:*`
- `webgpu:shader,execution,expression,call,builtin,textureNumSamples:sampled:*`
- `webgpu:shader,execution,expression,call,builtin,textureSample:sampled_1d_coords:*` on Windows and Linux
Otherwise are _many_ new `PASS`es in test variants that don't quite make entire test(s) pass, so this is definitely a good change. 🙂
- Some tests' variants have been deleted, since they are no longer reported due to _all_ runs of them `CRASH`ing due to timeout (rather than a stack crash). This will be dealt with in follow-up work. Since these tests are in tier 3, I don't see a hard problem with letting these be deleted for now.
Differential Revision: https://phabricator.services.mozilla.com/D240673
The callback may never be called if the parent process shuts down before getting the async result.
Another reason why bug 1937194 is wanted.
Differential Revision: https://phabricator.services.mozilla.com/D240497
This makes sendNotification*Event as [noscript] because there's no JS binding for IPCNotification. Fortunately there's no JS callers and I'm not planning to make one.
Differential Revision: https://phabricator.services.mozilla.com/D240187