diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index 3e5fbfaa4d2e..ddde8c3601f4 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -448,6 +448,7 @@ class ShutdownRunnable : public Runnable { NS_IMETHOD Run() override { LOG(("Closing BackgroundChild")); + // This will also destroy the CamerasChild. ipc::BackgroundChild::CloseForCurrentThread(); NS_DispatchToMainThread(mReplyEvent.forget()); @@ -472,17 +473,6 @@ void CamerasChild::ShutdownParent() { mIPCIsAlive = false; monitor.NotifyAll(); } - if (CamerasSingleton::Thread()) { - LOG(("Dispatching actor deletion")); - // Delete the parent actor. - // CamerasChild (this) will remain alive and is only deleted by the - // IPC layer when SendAllDone returns. - nsCOMPtr deleteRunnable = mozilla::NewRunnableMethod( - "camera::PCamerasChild::SendAllDone", this, &CamerasChild::SendAllDone); - CamerasSingleton::Thread()->Dispatch(deleteRunnable, NS_DISPATCH_NORMAL); - } else { - LOG(("ShutdownParent called without PBackground thread")); - } } void CamerasChild::ShutdownChild() { @@ -523,6 +513,7 @@ mozilla::ipc::IPCResult CamerasChild::RecvDeviceChange() { } void CamerasChild::ActorDestroy(ActorDestroyReason aWhy) { + LOG(("ActorDestroy")); MonitorAutoLock monitor(mReplyMonitor); mIPCIsAlive = false; // Hopefully prevent us from getting stuck diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp index 69a833ef6167..1001d53ad4fa 100644 --- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -1044,17 +1044,6 @@ void CamerasParent::StopIPC() { mDestroyed = true; } -mozilla::ipc::IPCResult CamerasParent::RecvAllDone() { - LOG("%s", __PRETTY_FUNCTION__); - // Don't try to send anything to the child now - mChildIsAlive = false; - IProtocol* mgr = Manager(); - if (!Send__delete__(this)) { - return IPC_FAIL_NO_REASON(mgr); - } - return IPC_OK(); -} - void CamerasParent::ActorDestroy(ActorDestroyReason aWhy) { // No more IPC from here LOG("%s", __PRETTY_FUNCTION__); diff --git a/dom/media/systemservices/CamerasParent.h b/dom/media/systemservices/CamerasParent.h index 88bad9768372..38b117ce27d9 100644 --- a/dom/media/systemservices/CamerasParent.h +++ b/dom/media/systemservices/CamerasParent.h @@ -95,7 +95,6 @@ class CamerasParent final : public PCamerasParent, mozilla::ipc::IPCResult RecvStopCapture(const CaptureEngine&, const int&) override; mozilla::ipc::IPCResult RecvReleaseFrame(mozilla::ipc::Shmem&&) override; - mozilla::ipc::IPCResult RecvAllDone() override; void ActorDestroy(ActorDestroyReason aWhy) override; mozilla::ipc::IPCResult RecvEnsureInitialized(const CaptureEngine&) override; diff --git a/dom/media/systemservices/PCameras.ipdl b/dom/media/systemservices/PCameras.ipdl index 054534ecfed2..535702cd68b6 100644 --- a/dom/media/systemservices/PCameras.ipdl +++ b/dom/media/systemservices/PCameras.ipdl @@ -85,8 +85,6 @@ parent: // transfers frame back async ReleaseFrame(Shmem s); - // Ask parent to delete us - async AllDone(); // setup camera engine async EnsureInitialized(CaptureEngine engine); };