mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 1422820 - Don't recurse too much when shutting down cameras. r=pehrsons
--HG-- extra : histedit_source : 2f3145f04e4ca35a412b9870a29ff26d28eab5d6
This commit is contained in:
parent
6a3772c982
commit
46da831f14
@ -34,7 +34,9 @@ CamerasSingleton::CamerasSingleton()
|
||||
: mCamerasMutex("CamerasSingleton::mCamerasMutex"),
|
||||
mCameras(nullptr),
|
||||
mCamerasChildThread(nullptr),
|
||||
mFakeDeviceChangeEventThread(nullptr) {
|
||||
mFakeDeviceChangeEventThread(nullptr),
|
||||
mInShutdown(false)
|
||||
{
|
||||
LOG(("CamerasSingleton: %p", this));
|
||||
}
|
||||
|
||||
@ -568,6 +570,9 @@ void
|
||||
Shutdown(void)
|
||||
{
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
|
||||
CamerasSingleton::StartShutdown();
|
||||
|
||||
CamerasChild* child = CamerasSingleton::Child();
|
||||
if (!child) {
|
||||
// We don't want to cause everything to get fired up if we're
|
||||
@ -728,7 +733,7 @@ CamerasChild::~CamerasChild()
|
||||
{
|
||||
LOG(("~CamerasChild: %p", this));
|
||||
|
||||
{
|
||||
if (!CamerasSingleton::InShutdown()) {
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
// In normal circumstances we've already shut down and the
|
||||
// following does nothing. But on fatal IPC errors we will
|
||||
|
@ -92,6 +92,14 @@ public:
|
||||
return gTheInstance.get()->mFakeDeviceChangeEventThread;
|
||||
}
|
||||
|
||||
static bool InShutdown() {
|
||||
return gTheInstance.get()->mInShutdown;
|
||||
}
|
||||
|
||||
static void StartShutdown() {
|
||||
gTheInstance.get()->mInShutdown = true;
|
||||
}
|
||||
|
||||
private:
|
||||
static Singleton<CamerasSingleton> gTheInstance;
|
||||
|
||||
@ -109,6 +117,7 @@ private:
|
||||
CamerasChild* mCameras;
|
||||
nsCOMPtr<nsIThread> mCamerasChildThread;
|
||||
nsCOMPtr<nsIThread> mFakeDeviceChangeEventThread;
|
||||
Atomic<bool> mInShutdown;
|
||||
};
|
||||
|
||||
// Get a pointer to a CamerasChild object we can use to do IPC with.
|
||||
|
Loading…
x
Reference in New Issue
Block a user