Backed out changesets 19b8d672b55d and 2980183d98fb (bug 1362338) for hazard analysis failures.

This commit is contained in:
Ryan VanderMeulen 2017-08-09 21:12:28 -04:00
Родитель 59bb5e96e7
Коммит 64905fbd5a
4 изменённых файлов: 35 добавлений и 44 удалений

Просмотреть файл

@ -40,6 +40,20 @@ nsHtml5Atom::~nsHtml5Atom()
nsStringBuffer::FromData(mString)->Release();
}
NS_IMETHODIMP_(MozExternalRefCountType)
nsHtml5Atom::AddRef()
{
NS_NOTREACHED("Attempt to AddRef an nsHtml5Atom.");
return 2;
}
NS_IMETHODIMP_(MozExternalRefCountType)
nsHtml5Atom::Release()
{
NS_NOTREACHED("Attempt to Release an nsHtml5Atom.");
return 1;
}
NS_IMETHODIMP
nsHtml5Atom::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
@ -47,7 +61,7 @@ nsHtml5Atom::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
NS_IMETHODIMP
nsHtml5Atom::ScriptableToString(nsAString& aBuf)
{
NS_NOTREACHED("Should not call ScriptableToString.");

Просмотреть файл

@ -18,7 +18,7 @@
class nsHtml5Atom final : public nsIAtom
{
public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
NS_DECL_ISUPPORTS
NS_DECL_NSIATOM
explicit nsHtml5Atom(const nsAString& aString);

Просмотреть файл

@ -128,16 +128,8 @@ private:
~DynamicAtom();
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIATOM
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
typedef mozilla::TrueType HasThreadSafeRefCnt;
MozExternalRefCountType DoAddRef();
MozExternalRefCountType DoRelease();
protected:
ThreadSafeAutoRefCnt mRefCnt;
NS_DECL_OWNINGTHREAD
};
#if defined(NS_BUILD_REFCNT_LOGGING)
@ -207,11 +199,23 @@ public:
// StaticAtom* pointer (in AtomTableClearEntry()), not an nsIAtom* pointer.
~StaticAtom() {}
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) final;
NS_DECL_ISUPPORTS
NS_DECL_NSIATOM
};
NS_IMPL_QUERY_INTERFACE(StaticAtom, nsIAtom);
NS_IMPL_QUERY_INTERFACE(StaticAtom, nsIAtom)
NS_IMETHODIMP_(MozExternalRefCountType)
StaticAtom::AddRef()
{
return 2;
}
NS_IMETHODIMP_(MozExternalRefCountType)
StaticAtom::Release()
{
return 1;
}
NS_IMETHODIMP
DynamicAtom::ScriptableToString(nsAString& aBuf)
@ -275,30 +279,6 @@ StaticAtom::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
//----------------------------------------------------------------------
NS_IMETHODIMP_(MozExternalRefCountType)
nsIAtom::AddRef()
{
MOZ_ASSERT(!IsHTML5Atom(), "Attempt to AddRef an nsHtml5Atom");
if (!IsDynamicAtom()) {
MOZ_ASSERT(IsStaticAtom());
return 2;
}
return static_cast<DynamicAtom*>(this)->DoAddRef();
}
NS_IMETHODIMP_(MozExternalRefCountType)
nsIAtom::Release()
{
MOZ_ASSERT(!IsHTML5Atom(), "Attempt to Release an nsHtml5Atom");
if (!IsDynamicAtom()) {
MOZ_ASSERT(IsStaticAtom());
return 1;
}
return static_cast<DynamicAtom*>(this)->DoRelease();
}
//----------------------------------------------------------------------
/**
* The shared hash table for atom lookups.
*
@ -504,8 +484,8 @@ DynamicAtom::GCAtomTableLocked(const MutexAutoLock& aProofOfLock,
NS_IMPL_QUERY_INTERFACE(DynamicAtom, nsIAtom)
MozExternalRefCountType
DynamicAtom::DoAddRef()
NS_IMETHODIMP_(MozExternalRefCountType)
DynamicAtom::AddRef(void)
{
nsrefcnt count = ++mRefCnt;
if (count == 1) {
@ -522,8 +502,8 @@ static const uint32_t kAtomGCThreshold = 20;
static const uint32_t kAtomGCThreshold = 10000;
#endif
MozExternalRefCountType
DynamicAtom::DoRelease()
NS_IMETHODIMP_(MozExternalRefCountType)
DynamicAtom::Release(void)
{
MOZ_ASSERT(mRefCnt > 0);
nsrefcnt count = --mRefCnt;

Просмотреть файл

@ -95,9 +95,6 @@ interface nsIAtom : nsISupports
return nsStringBuffer::FromData(mString);
}
NS_IMETHOD_(MozExternalRefCountType) AddRef() final;
NS_IMETHOD_(MozExternalRefCountType) Release() final;
/**
* A hashcode that is better distributed than the actual atom
* pointer, for use in situations that need a well-distributed