Bug 1757505 remove unnecessary AllDone() message r=jib

Closing the BackgroundChild for the media thread is sufficient to destroy the
actors.
https://searchfox.org/mozilla-central/rev/9f61d854547cedbde0773b2893e4f925352be3b3/ipc/glue/BackgroundImpl.cpp#409

Depends on D140027

Differential Revision: https://phabricator.services.mozilla.com/D140028
This commit is contained in:
Karl Tomlinson 2022-03-17 04:10:06 +00:00
parent 2af2245080
commit 5cf10ab86d
4 changed files with 2 additions and 25 deletions

View File

@ -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<nsIRunnable> 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

View File

@ -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__);

View File

@ -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;

View File

@ -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);
};