зеркало из https://github.com/mozilla/pjs.git
Fix threadsafety regression so we're back to the old broken state. b=335734 r=sicking rs=brendan
This commit is contained in:
Родитель
11521580d2
Коммит
0c9372c940
|
@ -397,7 +397,7 @@ AtomImpl::~AtomImpl()
|
||||||
// Permanent atoms are removed from the hashtable at shutdown, and we
|
// Permanent atoms are removed from the hashtable at shutdown, and we
|
||||||
// don't want to remove them twice. See comment above in
|
// don't want to remove them twice. See comment above in
|
||||||
// |AtomTableClearEntry|.
|
// |AtomTableClearEntry|.
|
||||||
if (!IsPermanent()) {
|
if (!IsPermanentInDestructor()) {
|
||||||
AtomTableEntry key(mString);
|
AtomTableEntry key(mString);
|
||||||
PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_REMOVE);
|
PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_REMOVE);
|
||||||
if (gAtomTable.entryCount == 0) {
|
if (gAtomTable.entryCount == 0) {
|
||||||
|
@ -413,6 +413,11 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(AtomImpl, nsIAtom)
|
||||||
PermanentAtomImpl::PermanentAtomImpl()
|
PermanentAtomImpl::PermanentAtomImpl()
|
||||||
: AtomImpl()
|
: AtomImpl()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PermanentAtomImpl::~PermanentAtomImpl()
|
||||||
|
{
|
||||||
|
// So we can tell if we were permanent while running the base class dtor.
|
||||||
mRefCnt = REFCNT_PERMANENT_SENTINEL;
|
mRefCnt = REFCNT_PERMANENT_SENTINEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +431,18 @@ NS_IMETHODIMP_(nsrefcnt) PermanentAtomImpl::Release()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ PRBool
|
||||||
|
AtomImpl::IsPermanent()
|
||||||
|
{
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* virtual */ PRBool
|
||||||
|
PermanentAtomImpl::IsPermanent()
|
||||||
|
{
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void* AtomImpl::operator new ( size_t size, const nsACString& aString ) CPP_THROW_NEW
|
void* AtomImpl::operator new ( size_t size, const nsACString& aString ) CPP_THROW_NEW
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -61,7 +61,12 @@ public:
|
||||||
|
|
||||||
enum { REFCNT_PERMANENT_SENTINEL = PR_UINT32_MAX };
|
enum { REFCNT_PERMANENT_SENTINEL = PR_UINT32_MAX };
|
||||||
|
|
||||||
PRBool IsPermanent() { return mRefCnt == REFCNT_PERMANENT_SENTINEL; }
|
virtual PRBool IsPermanent();
|
||||||
|
|
||||||
|
// We can't use the virtual function in the base class destructor.
|
||||||
|
PRBool IsPermanentInDestructor() {
|
||||||
|
return mRefCnt == REFCNT_PERMANENT_SENTINEL;
|
||||||
|
}
|
||||||
|
|
||||||
void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW;
|
void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW;
|
||||||
|
|
||||||
|
@ -84,9 +89,12 @@ public:
|
||||||
class PermanentAtomImpl : public AtomImpl {
|
class PermanentAtomImpl : public AtomImpl {
|
||||||
public:
|
public:
|
||||||
PermanentAtomImpl();
|
PermanentAtomImpl();
|
||||||
|
~PermanentAtomImpl();
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||||
NS_IMETHOD_(nsrefcnt) Release();
|
NS_IMETHOD_(nsrefcnt) Release();
|
||||||
|
|
||||||
|
virtual PRBool IsPermanent();
|
||||||
|
|
||||||
void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW {
|
void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW {
|
||||||
return AtomImpl::operator new(size, aString);
|
return AtomImpl::operator new(size, aString);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче