diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /js/src/gc/GCLock.h | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/gc/GCLock.h')
-rw-r--r-- | js/src/gc/GCLock.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/js/src/gc/GCLock.h b/js/src/gc/GCLock.h index 64c28ac544..86429106d2 100644 --- a/js/src/gc/GCLock.h +++ b/js/src/gc/GCLock.h @@ -15,8 +15,6 @@ namespace js { -class AutoUnlockGC; - /* * RAII class that takes the GC lock while it is live. * @@ -32,7 +30,7 @@ class MOZ_RAII AutoLockGC { ~AutoLockGC() { lockGuard_.reset(); } - js::LockGuard<js::Mutex>& guard() { return lockGuard_.ref(); } + LockGuard<Mutex>& guard() { return lockGuard_.ref(); } protected: void lock() { @@ -48,12 +46,12 @@ class MOZ_RAII AutoLockGC { gc::GCRuntime* const gc; private: - mozilla::Maybe<js::LockGuard<js::Mutex>> lockGuard_; + mozilla::Maybe<LockGuard<Mutex>> lockGuard_; AutoLockGC(const AutoLockGC&) = delete; AutoLockGC& operator=(const AutoLockGC&) = delete; - friend class AutoUnlockGC; // For lock/unlock. + friend class UnlockGuard<AutoLockGC>; // For lock/unlock. }; /* @@ -92,18 +90,7 @@ class MOZ_RAII AutoLockGCBgAlloc : public AutoLockGC { bool startBgAlloc = false; }; -class MOZ_RAII AutoUnlockGC { - public: - explicit AutoUnlockGC(AutoLockGC& lock) : lock(lock) { lock.unlock(); } - - ~AutoUnlockGC() { lock.lock(); } - - private: - AutoLockGC& lock; - - AutoUnlockGC(const AutoUnlockGC&) = delete; - AutoUnlockGC& operator=(const AutoUnlockGC&) = delete; -}; +using AutoUnlockGC = UnlockGuard<AutoLockGC>; } // namespace js |