diff options
author | Paul Adenot <paul@paul.cx> | 2018-04-16 10:51:48 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-10 11:45:57 +0200 |
commit | dc7515e3d7456201d5d841a6561dd565d23eaebd (patch) | |
tree | 3cb87adc32c0970a545f5be414f7c3ced89e4bf6 /dom/media/systemservices/CamerasChild.h | |
parent | 2218925961f4a086f185a04a4b5a26da921c7a4a (diff) | |
download | UXP-dc7515e3d7456201d5d841a6561dd565d23eaebd.tar UXP-dc7515e3d7456201d5d841a6561dd565d23eaebd.tar.gz UXP-dc7515e3d7456201d5d841a6561dd565d23eaebd.tar.lz UXP-dc7515e3d7456201d5d841a6561dd565d23eaebd.tar.xz UXP-dc7515e3d7456201d5d841a6561dd565d23eaebd.zip |
Bug 1426129 - Hold CamerasChild via promoting "this" to a RefPtr. r=pehrsons, a=RyanVM
Diffstat (limited to 'dom/media/systemservices/CamerasChild.h')
-rw-r--r-- | dom/media/systemservices/CamerasChild.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dom/media/systemservices/CamerasChild.h b/dom/media/systemservices/CamerasChild.h index 1530714e9..9ca125cfd 100644 --- a/dom/media/systemservices/CamerasChild.h +++ b/dom/media/systemservices/CamerasChild.h @@ -89,6 +89,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; @@ -106,6 +114,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. @@ -145,7 +154,7 @@ class CamerasChild final : public PCamerasChild public: // We are owned by the PBackground thread only. CamerasSingleton // takes a non-owning reference. - NS_INLINE_DECL_REFCOUNTING(CamerasChild) + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CamerasChild) // IPC messages recevied, received on the PBackground thread // these are the actual callbacks with data |