зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444031 - Rename Is{Static,Dynamic,HTML5}Atom. r=froydnj
By removing the "Atom" suffix, which is redundant. MozReview-Commit-ID: 4MCX9Icfjrw --HG-- extra : rebase_source : c3c759a508a8938b59d36dbb20448d2964b98c91
This commit is contained in:
Родитель
ccb14316da
Коммит
8ac9830be0
|
@ -1839,7 +1839,7 @@ nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
|
|||
}
|
||||
|
||||
nsAtom* localName = aContent->NodeInfo()->NameAtom();
|
||||
return localName->IsStaticAtom() ? localName : nullptr;
|
||||
return localName->IsStatic() ? localName : nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
MOZ_ASSERT(!mStringBuffer, "Setting stringbuffer twice?");
|
||||
MOZ_ASSERT(aAtom || aNullHandling != eNullNotExpected);
|
||||
if (aNullHandling == eNullNotExpected || aAtom) {
|
||||
if (aAtom->IsStaticAtom()) {
|
||||
if (aAtom->IsStatic()) {
|
||||
// Static atoms are backed by literals.
|
||||
SetLiteralInternal(aAtom->GetUTF16String(), aAtom->GetLength());
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ class nsHtml5AtomEntry : public nsStringHashKey
|
|||
* the same nsHtml5Parser/nsHtml5StreamParser instance that owns the
|
||||
* nsHtml5AtomTable instance.
|
||||
*
|
||||
* Dynamic atoms (atoms whose IsStaticAtom() returns false) obtained from
|
||||
* Dynamic atoms (atoms whose IsStatic() returns false) obtained from
|
||||
* nsHtml5AtomTable must be re-obtained from another atom table when there's a
|
||||
* need to migrate atoms from an nsHtml5Parser to its nsHtml5StreamParser
|
||||
* (re-obtain from the other nsHtml5AtomTable), from an nsHtml5Parser to its
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
// Only the local names may be non-static, in which case all three
|
||||
// are the same.
|
||||
nsAtom* local = GetLocal(0);
|
||||
if (!local->IsStaticAtom()) {
|
||||
if (!local->IsStatic()) {
|
||||
nsAutoString str;
|
||||
local->ToString(str);
|
||||
local = aInterner->GetAtom(str);
|
||||
|
|
|
@ -87,7 +87,7 @@ nsHtml5Portability::newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner)
|
|||
{
|
||||
NS_PRECONDITION(local, "Atom was null.");
|
||||
NS_PRECONDITION(interner, "Atom table was null");
|
||||
if (!local->IsStaticAtom()) {
|
||||
if (!local->IsStatic()) {
|
||||
nsAutoString str;
|
||||
local->ToString(str);
|
||||
local = interner->GetAtom(str);
|
||||
|
|
|
@ -112,7 +112,7 @@ class nsHtml5TreeOperation final {
|
|||
*/
|
||||
static inline already_AddRefed<nsAtom> Reget(nsAtom* aAtom)
|
||||
{
|
||||
if (!aAtom || aAtom->IsStaticAtom()) {
|
||||
if (!aAtom || aAtom->IsStatic()) {
|
||||
return dont_AddRef(aAtom);
|
||||
}
|
||||
nsAutoString str;
|
||||
|
|
|
@ -40,9 +40,9 @@ public:
|
|||
|
||||
AtomKind Kind() const { return static_cast<AtomKind>(mKind); }
|
||||
|
||||
bool IsDynamicAtom() const { return Kind() == AtomKind::DynamicAtom; }
|
||||
bool IsHTML5Atom() const { return Kind() == AtomKind::HTML5Atom; }
|
||||
bool IsStaticAtom() const { return Kind() == AtomKind::StaticAtom; }
|
||||
bool IsDynamic() const { return Kind() == AtomKind::DynamicAtom; }
|
||||
bool IsHTML5() const { return Kind() == AtomKind::HTML5Atom; }
|
||||
bool IsStatic() const { return Kind() == AtomKind::StaticAtom; }
|
||||
|
||||
char16ptr_t GetUTF16String() const { return mString; }
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
nsStringBuffer* GetStringBuffer() const
|
||||
{
|
||||
// See the comment on |mString|'s declaration.
|
||||
MOZ_ASSERT(IsDynamicAtom() || IsHTML5Atom());
|
||||
MOZ_ASSERT(IsDynamic() || IsHTML5());
|
||||
return nsStringBuffer::FromData(const_cast<char16_t*>(mString));
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
//
|
||||
uint32_t hash() const
|
||||
{
|
||||
MOZ_ASSERT(!IsHTML5Atom());
|
||||
MOZ_ASSERT(!IsHTML5());
|
||||
return mHash;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
static nsDynamicAtom* As(nsAtom* aAtom)
|
||||
{
|
||||
MOZ_ASSERT(aAtom->IsDynamicAtom());
|
||||
MOZ_ASSERT(aAtom->IsDynamic());
|
||||
return static_cast<nsDynamicAtom*>(aAtom);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ nsAtom::nsAtom(AtomKind aKind, const nsAString& aString, uint32_t aHash)
|
|||
{
|
||||
MOZ_ASSERT(aKind == AtomKind::DynamicAtom || aKind == AtomKind::HTML5Atom);
|
||||
|
||||
MOZ_ASSERT_IF(!IsHTML5Atom(), mHash == HashString(mString, mLength));
|
||||
MOZ_ASSERT_IF(!IsHTML5(), mHash == HashString(mString, mLength));
|
||||
|
||||
MOZ_ASSERT(mString[mLength] == char16_t(0), "null terminated");
|
||||
MOZ_ASSERT(Equals(aString), "correct data");
|
||||
|
@ -150,8 +150,8 @@ nsAtom::nsAtom(const char16_t* aString, uint32_t aLength, uint32_t aHash)
|
|||
|
||||
nsAtom::~nsAtom()
|
||||
{
|
||||
if (!IsStaticAtom()) {
|
||||
MOZ_ASSERT(IsDynamicAtom() || IsHTML5Atom());
|
||||
if (!IsStatic()) {
|
||||
MOZ_ASSERT(IsDynamic() || IsHTML5());
|
||||
GetStringBuffer()->Release();
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ void
|
|||
nsAtom::ToString(nsAString& aString) const
|
||||
{
|
||||
// See the comment on |mString|'s declaration.
|
||||
if (IsStaticAtom()) {
|
||||
if (IsStatic()) {
|
||||
// AssignLiteral() lets us assign without copying. This isn't a string
|
||||
// literal, but it's a static atom and thus has an unbounded lifetime,
|
||||
// which is what's important.
|
||||
|
@ -173,7 +173,7 @@ nsAtom::ToString(nsAString& aString) const
|
|||
void
|
||||
nsAtom::ToUTF8String(nsACString& aBuf) const
|
||||
{
|
||||
MOZ_ASSERT(!IsHTML5Atom(), "Called ToUTF8String() on an HTML5 atom");
|
||||
MOZ_ASSERT(!IsHTML5(), "Called ToUTF8String() on an HTML5 atom");
|
||||
CopyUTF16toUTF8(nsDependentString(mString, mLength), aBuf);
|
||||
}
|
||||
|
||||
|
@ -181,10 +181,10 @@ void
|
|||
nsAtom::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf, AtomsSizes& aSizes)
|
||||
const
|
||||
{
|
||||
MOZ_ASSERT(!IsHTML5Atom(),
|
||||
MOZ_ASSERT(!IsHTML5(),
|
||||
"Called AddSizeOfIncludingThis() on an HTML5 atom");
|
||||
size_t thisSize = aMallocSizeOf(this);
|
||||
if (IsStaticAtom()) {
|
||||
if (IsStatic()) {
|
||||
// String buffers pointed to by static atoms are in static memory, and so
|
||||
// are not measured here.
|
||||
aSizes.mStaticAtomObjects += thisSize;
|
||||
|
@ -360,7 +360,7 @@ nsAtomTable::AtomTableClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
|
|||
{
|
||||
auto entry = static_cast<AtomTableEntry*>(aEntry);
|
||||
nsAtom* atom = entry->mAtom;
|
||||
if (atom->IsStaticAtom()) {
|
||||
if (atom->IsStatic()) {
|
||||
// This case -- when the entry being cleared holds a static atom -- only
|
||||
// occurs when gAtomTable is destroyed, whereupon all static atoms within it
|
||||
// must be explicitly deleted.
|
||||
|
@ -504,13 +504,13 @@ nsAtomSubTable::GCLocked(GCKind aKind)
|
|||
uint32_t nonZeroRefcountAtomsCount = 0;
|
||||
for (auto i = mTable.Iter(); !i.Done(); i.Next()) {
|
||||
auto entry = static_cast<AtomTableEntry*>(i.Get());
|
||||
if (entry->mAtom->IsStaticAtom()) {
|
||||
if (entry->mAtom->IsStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAtom* atom = entry->mAtom;
|
||||
MOZ_ASSERT(!atom->IsHTML5Atom());
|
||||
if (atom->IsDynamicAtom() && nsDynamicAtom::As(atom)->mRefCnt == 0) {
|
||||
MOZ_ASSERT(!atom->IsHTML5());
|
||||
if (atom->IsDynamic() && nsDynamicAtom::As(atom)->mRefCnt == 0) {
|
||||
i.Remove();
|
||||
delete atom;
|
||||
++removedCount;
|
||||
|
@ -588,17 +588,17 @@ nsDynamicAtom::Release()
|
|||
MozExternalRefCountType
|
||||
nsAtom::AddRef()
|
||||
{
|
||||
MOZ_ASSERT(!IsHTML5Atom(), "Attempt to AddRef an HTML5 atom");
|
||||
MOZ_ASSERT(!IsHTML5(), "Attempt to AddRef an HTML5 atom");
|
||||
|
||||
return IsStaticAtom() ? 2 : nsDynamicAtom::As(this)->AddRef();
|
||||
return IsStatic() ? 2 : nsDynamicAtom::As(this)->AddRef();
|
||||
}
|
||||
|
||||
MozExternalRefCountType
|
||||
nsAtom::Release()
|
||||
{
|
||||
MOZ_ASSERT(!IsHTML5Atom(), "Attempt to Release an HTML5 atom");
|
||||
MOZ_ASSERT(!IsHTML5(), "Attempt to Release an HTML5 atom");
|
||||
|
||||
return IsStaticAtom() ? 1 : nsDynamicAtom::As(this)->Release();
|
||||
return IsStatic() ? 1 : nsDynamicAtom::As(this)->Release();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -697,7 +697,7 @@ nsAtomTable::RegisterStaticAtoms(const nsStaticAtomSetup* aSetup,
|
|||
// Disallow creating a dynamic atom, and then later, while the dynamic
|
||||
// atom is still alive, registering that same atom as a static atom. It
|
||||
// causes subtle bugs, and we're programming in C++ here, not Smalltalk.
|
||||
if (!he->mAtom->IsStaticAtom()) {
|
||||
if (!he->mAtom->IsStatic()) {
|
||||
nsAutoCString name;
|
||||
he->mAtom->ToUTF8String(name);
|
||||
MOZ_CRASH_UNSAFE_PRINTF(
|
||||
|
@ -866,7 +866,7 @@ nsAtomTable::GetStaticAtom(const nsAString& aUTF16String)
|
|||
nsAtomSubTable& table = SelectSubTable(key);
|
||||
MutexAutoLock lock(table.mLock);
|
||||
AtomTableEntry* he = table.Search(key);
|
||||
return he && he->mAtom->IsStaticAtom()
|
||||
return he && he->mAtom->IsStatic()
|
||||
? static_cast<nsStaticAtom*>(he->mAtom)
|
||||
: nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче