--- a/dom/media/systemservices/CamerasChild.h+++ b/dom/media/systemservices/CamerasChild.h@@ -89,32 +89,38 @@ public: return gTheInstance.get()->mCameras; } static nsCOMPtr<nsIThread>& Thread() { Mutex().AssertCurrentThreadOwns(); return gTheInstance.get()->mCamerasChildThread; }+ static nsCOMPtr<nsIThread>& FakeDeviceChangeEventThread() {+ Mutex().AssertCurrentThreadOwns();+ return gTheInstance.get()->mFakeDeviceChangeEventThread;+ }+ private: static Singleton<CamerasSingleton> gTheInstance; // Reinitializing CamerasChild will change the pointers below. // We don't want this to happen in the middle of preparing IPC. // We will be alive on destruction, so this needs to be off the books. mozilla::OffTheBooksMutex mCamerasMutex; // This is owned by the IPC code, and the same code controls the lifetime. // It will set and clear this pointer as appropriate in setup/teardown. // We'd normally make this a WeakPtr but unfortunately the IPC code already // uses the WeakPtr mixin in a protected base class of CamerasChild, and in // any case the object becomes unusable as soon as IPC is tearing down, which // will be before actual destruction. CamerasChild* mCameras; nsCOMPtr<nsIThread> mCamerasChildThread;+ nsCOMPtr<nsIThread> mFakeDeviceChangeEventThread; }; // Get a pointer to a CamerasChild object we can use to do IPC with. // This does everything needed to set up, including starting the IPC // channel with PBackground, blocking until thats done, and starting the // thread to do IPC on. This will fail if we're in shutdown. On success // it will set up the CamerasSingleton. CamerasChild* GetCamerasChild();