mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 912299 - Make RefCounted's refcount field mutable. r=waldo
This commit is contained in:
parent
46d89c4cba
commit
1d6372adb1
@ -68,18 +68,18 @@ class RefCounted
|
||||
|
||||
public:
|
||||
// Compatibility with nsRefPtr.
|
||||
void AddRef() {
|
||||
void AddRef() const {
|
||||
MOZ_ASSERT(refCnt >= 0);
|
||||
++refCnt;
|
||||
}
|
||||
|
||||
void Release() {
|
||||
void Release() const {
|
||||
MOZ_ASSERT(refCnt > 0);
|
||||
if (0 == --refCnt) {
|
||||
#ifdef DEBUG
|
||||
refCnt = detail::DEAD;
|
||||
#endif
|
||||
delete static_cast<T*>(this);
|
||||
delete static_cast<const T*>(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class RefCounted
|
||||
}
|
||||
|
||||
private:
|
||||
typename Conditional<Atomicity == AtomicRefCount, Atomic<int>, int>::Type refCnt;
|
||||
mutable typename Conditional<Atomicity == AtomicRefCount, Atomic<int>, int>::Type refCnt;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class LibHandle;
|
||||
namespace mozilla {
|
||||
namespace detail {
|
||||
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release();
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release() const;
|
||||
|
||||
template <> inline RefCounted<LibHandle, AtomicRefCount>::~RefCounted()
|
||||
{
|
||||
@ -215,7 +215,7 @@ private:
|
||||
namespace mozilla {
|
||||
namespace detail {
|
||||
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release() {
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release() const {
|
||||
#ifdef DEBUG
|
||||
if (refCnt > 0x7fff0000)
|
||||
MOZ_ASSERT(refCnt > 0x7fffdead);
|
||||
@ -228,7 +228,7 @@ template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release() {
|
||||
#else
|
||||
refCnt = 1;
|
||||
#endif
|
||||
delete static_cast<LibHandle*>(this);
|
||||
delete static_cast<const LibHandle*>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user