mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 865583 - Use thread-safe ref-counting in the linker. r=nfroyd
This commit is contained in:
parent
32f20f1c9f
commit
5215bd9e2d
@ -70,9 +70,9 @@ class LibHandle;
|
||||
namespace mozilla {
|
||||
namespace detail {
|
||||
|
||||
template <> inline void RefCounted<LibHandle, NonAtomicRefCount>::Release();
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release();
|
||||
|
||||
template <> inline RefCounted<LibHandle, NonAtomicRefCount>::~RefCounted()
|
||||
template <> inline RefCounted<LibHandle, AtomicRefCount>::~RefCounted()
|
||||
{
|
||||
MOZ_ASSERT(refCnt == 0x7fffdead);
|
||||
}
|
||||
@ -87,7 +87,7 @@ class Mappable;
|
||||
* Abstract class for loaded libraries. Libraries may be loaded through the
|
||||
* system linker or this linker, both cases will be derived from this class.
|
||||
*/
|
||||
class LibHandle: public mozilla::RefCounted<LibHandle>
|
||||
class LibHandle: public mozilla::AtomicRefCounted<LibHandle>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@ -138,7 +138,7 @@ public:
|
||||
void AddDirectRef()
|
||||
{
|
||||
++directRefCnt;
|
||||
mozilla::RefCounted<LibHandle>::AddRef();
|
||||
mozilla::AtomicRefCounted<LibHandle>::AddRef();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,10 +149,11 @@ public:
|
||||
{
|
||||
bool ret = false;
|
||||
if (directRefCnt) {
|
||||
MOZ_ASSERT(directRefCnt <= mozilla::RefCounted<LibHandle>::refCount());
|
||||
MOZ_ASSERT(directRefCnt <=
|
||||
mozilla::AtomicRefCounted<LibHandle>::refCount());
|
||||
if (--directRefCnt)
|
||||
ret = true;
|
||||
mozilla::RefCounted<LibHandle>::Release();
|
||||
mozilla::AtomicRefCounted<LibHandle>::Release();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -217,7 +218,7 @@ private:
|
||||
namespace mozilla {
|
||||
namespace detail {
|
||||
|
||||
template <> inline void RefCounted<LibHandle, NonAtomicRefCount>::Release() {
|
||||
template <> inline void RefCounted<LibHandle, AtomicRefCount>::Release() {
|
||||
#ifdef DEBUG
|
||||
if (refCnt > 0x7fff0000)
|
||||
MOZ_ASSERT(refCnt > 0x7fffdead);
|
||||
|
@ -26,7 +26,7 @@ class ZipCollection;
|
||||
* libraries from Zip archives, there is no interest in making this code
|
||||
* safe, since the libraries could contain malicious code anyways.
|
||||
*/
|
||||
class Zip: public mozilla::RefCounted<Zip>
|
||||
class Zip: public mozilla::AtomicRefCounted<Zip>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user