Bug 1858731 - Ensure CanvasManagerChild releases its DOM worker reference on IPDL errors. r=gfx-reviewers,lsalzman

This patch ensures that we destroy CanvasManagerChild::mWorkerRef if our
IPDL actor is destroyed without the DOM worker having been destroyed.
This can occur when the GPU process crashes, or IPDL itself encountered
an internal error. Since mWorkerRef keeps a reference to
CanvasManagerChild for its shutdown callback, this means the object
won't get freed until the DOM worker itself shuts down.

Depends on D190830

Differential Revision: https://phabricator.services.mozilla.com/D190831
This commit is contained in:
Andrew Osmond 2023-10-13 13:34:06 +00:00
parent d8e189e0a0
commit 7a7a8eb1bc

View File

@ -34,6 +34,7 @@ void CanvasManagerChild::ActorDestroy(ActorDestroyReason aReason) {
if (sLocalManager.get() == this) {
sLocalManager.set(nullptr);
}
mWorkerRef = nullptr;
}
void CanvasManagerChild::Destroy() {
@ -42,9 +43,9 @@ void CanvasManagerChild::Destroy() {
mCanvasChild = nullptr;
}
// The caller has a strong reference. ActorDestroy will clear sLocalManager.
// The caller has a strong reference. ActorDestroy will clear sLocalManager
// and mWorkerRef.
Close();
mWorkerRef = nullptr;
}
/* static */ void CanvasManagerChild::Shutdown() {