mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1757505 remove unnecessary lock and notify on shutdown r=jib
mIPCIsAlive is already cleared and notified before Shutdown() is called on the IPC thread. mIPCIsAlive is read only in DispatchToParent() on the MediaManager thread, which cannot happen while Shutdown() is called on the same thread. Depends on D140029 Differential Revision: https://phabricator.services.mozilla.com/D140030
This commit is contained in:
parent
89c4564af8
commit
c534faa84e
@ -425,19 +425,6 @@ int CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) {
|
||||
return dispatcher.ReturnValue();
|
||||
}
|
||||
|
||||
void Shutdown(void) {
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
|
||||
CamerasChild* child = CamerasSingleton::Child();
|
||||
if (!child) {
|
||||
// We don't want to cause everything to get fired up if we're
|
||||
// really already shut down.
|
||||
LOG(("Shutdown when already shut down"));
|
||||
return;
|
||||
}
|
||||
child->ShutdownAll();
|
||||
}
|
||||
|
||||
class ShutdownRunnable : public Runnable {
|
||||
public:
|
||||
explicit ShutdownRunnable(already_AddRefed<Runnable>&& aReplyEvent)
|
||||
@ -457,23 +444,18 @@ class ShutdownRunnable : public Runnable {
|
||||
RefPtr<Runnable> mReplyEvent;
|
||||
};
|
||||
|
||||
void CamerasChild::ShutdownAll() {
|
||||
// Called with CamerasSingleton::Mutex() held
|
||||
ShutdownParent();
|
||||
ShutdownChild();
|
||||
}
|
||||
void Shutdown(void) {
|
||||
// Called from both MediaEngineWebRTC::Shutdown() on the MediaManager thread
|
||||
// and DeallocPCamerasChild() on the dedicated IPC thread.
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
|
||||
void CamerasChild::ShutdownParent() {
|
||||
// Called with CamerasSingleton::Mutex() held
|
||||
{
|
||||
MonitorAutoLock monitor(mReplyMonitor);
|
||||
mIPCIsAlive = false;
|
||||
monitor.NotifyAll();
|
||||
CamerasChild* child = CamerasSingleton::Child();
|
||||
if (!child) {
|
||||
// We don't want to cause everything to get fired up if we're
|
||||
// really already shut down.
|
||||
LOG(("Shutdown when already shut down"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CamerasChild::ShutdownChild() {
|
||||
// Called with CamerasSingleton::Mutex() held
|
||||
if (CamerasSingleton::Thread()) {
|
||||
LOG(("PBackground thread exists, dispatching close"));
|
||||
// The IPC thread is shut down on the main thread after the
|
||||
|
@ -189,7 +189,6 @@ class CamerasChild final : public PCamerasChild {
|
||||
char* unique_idUTF8,
|
||||
const unsigned int unique_idUTF8Length,
|
||||
bool* scary = nullptr);
|
||||
void ShutdownAll();
|
||||
int EnsureInitialized(CaptureEngine aCapEngine);
|
||||
|
||||
template <typename This>
|
||||
@ -224,8 +223,6 @@ class CamerasChild final : public PCamerasChild {
|
||||
void AddCallback(const CaptureEngine aCapEngine, const int capture_id,
|
||||
FrameRelay* render);
|
||||
void RemoveCallback(const CaptureEngine aCapEngine, const int capture_id);
|
||||
void ShutdownParent();
|
||||
void ShutdownChild();
|
||||
|
||||
nsTArray<CapturerElement> mCallbacks;
|
||||
// Protects the callback arrays
|
||||
|
Loading…
Reference in New Issue
Block a user