Bug 1004564 - Move AtomicRefCounted to mozilla::external and outlaw it in Gecko code; r=froydnj

This commit is contained in:
Ehsan Akhgari 2014-05-01 14:33:20 -04:00
parent 0b87d37000
commit ef0b7d19aa
3 changed files with 13 additions and 6 deletions

View File

@ -179,12 +179,17 @@ class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount>
}
};
namespace external {
/**
* AtomicRefCounted<T> is like RefCounted<T>, with an atomically updated
* reference counter.
*
* NOTE: Please do not use this class, use NS_INLINE_DECL_THREADSAFE_REFCOUNTING
* instead.
*/
template<typename T>
class AtomicRefCounted : public detail::RefCounted<T, detail::AtomicRefCount>
class AtomicRefCounted : public mozilla::detail::RefCounted<T, mozilla::detail::AtomicRefCount>
{
public:
~AtomicRefCounted() {
@ -193,6 +198,8 @@ class AtomicRefCounted : public detail::RefCounted<T, detail::AtomicRefCount>
}
};
}
/**
* RefPtr points to a refcounted thing that has AddRef and Release
* methods to increase/decrease the refcount, respectively. After a

View File

@ -88,7 +88,7 @@ template <> inline RefCounted<LibHandle, AtomicRefCount>::~RefCounted()
* 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::AtomicRefCounted<LibHandle>
class LibHandle: public mozilla::external::AtomicRefCounted<LibHandle>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LibHandle)
@ -140,7 +140,7 @@ public:
void AddDirectRef()
{
++directRefCnt;
mozilla::AtomicRefCounted<LibHandle>::AddRef();
mozilla::external::AtomicRefCounted<LibHandle>::AddRef();
}
/**
@ -152,10 +152,10 @@ public:
bool ret = false;
if (directRefCnt) {
MOZ_ASSERT(directRefCnt <=
mozilla::AtomicRefCounted<LibHandle>::refCount());
mozilla::external::AtomicRefCounted<LibHandle>::refCount());
if (--directRefCnt)
ret = true;
mozilla::AtomicRefCounted<LibHandle>::Release();
mozilla::external::AtomicRefCounted<LibHandle>::Release();
}
return ret;
}

View File

@ -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::AtomicRefCounted<Zip>
class Zip: public mozilla::external::AtomicRefCounted<Zip>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Zip)