From 19cdeba085a188a5207d22975846d6de04ff8ff8 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Wed, 19 Apr 2006 21:46:47 +0000 Subject: [PATCH] Make IsPermanent non-virtual so it can be called in the destructor. b=334605 r=mrbkap rs=brendan --- xpcom/ds/nsAtomTable.cpp | 18 ++++++------------ xpcom/ds/nsAtomTable.h | 10 ++++------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index cc670be5aff5..b2aa909b54fc 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -410,6 +410,12 @@ AtomImpl::~AtomImpl() NS_IMPL_THREADSAFE_ISUPPORTS1(AtomImpl, nsIAtom) +PermanentAtomImpl::PermanentAtomImpl() + : AtomImpl() +{ + mRefCnt = REFCNT_PERMANENT_SENTINEL; +} + NS_IMETHODIMP_(nsrefcnt) PermanentAtomImpl::AddRef() { return 2; @@ -420,18 +426,6 @@ NS_IMETHODIMP_(nsrefcnt) PermanentAtomImpl::Release() 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 { /* diff --git a/xpcom/ds/nsAtomTable.h b/xpcom/ds/nsAtomTable.h index d8971cf76f17..65f170d64cf3 100644 --- a/xpcom/ds/nsAtomTable.h +++ b/xpcom/ds/nsAtomTable.h @@ -59,7 +59,9 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIATOM - virtual PRBool IsPermanent(); + enum { REFCNT_PERMANENT_SENTINEL = PR_UINT32_MAX }; + + PRBool IsPermanent() { return mRefCnt == REFCNT_PERMANENT_SENTINEL; } void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW; @@ -81,14 +83,10 @@ public: class PermanentAtomImpl : public AtomImpl { public: -#ifdef AIX - PermanentAtomImpl() : AtomImpl() {} -#endif + PermanentAtomImpl(); NS_IMETHOD_(nsrefcnt) AddRef(); NS_IMETHOD_(nsrefcnt) Release(); - virtual PRBool IsPermanent(); - void* operator new(size_t size, const nsACString& aString) CPP_THROW_NEW { return AtomImpl::operator new(size, aString); }