Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.

This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ
This commit is contained in:
Nicholas Nethercote
2017-09-26 08:33:21 +10:00
parent df61e8aad8
commit 9fda5528d2
210 changed files with 694 additions and 710 deletions

View File

@@ -100,7 +100,7 @@ nsDOMStringMap::NamedSetter(const nsAString& aProp,
return;
}
nsCOMPtr<nsIAtom> attrAtom = NS_Atomize(attr);
RefPtr<nsIAtom> attrAtom = NS_Atomize(attr);
MOZ_ASSERT(attrAtom, "Should be infallible");
res = mElement->SetAttr(kNameSpaceID_None, attrAtom, aValue, true);
@@ -124,7 +124,7 @@ nsDOMStringMap::NamedDeleter(const nsAString& aProp, bool& found)
return;
}
nsCOMPtr<nsIAtom> attrAtom = NS_Atomize(attr);
RefPtr<nsIAtom> attrAtom = NS_Atomize(attr);
MOZ_ASSERT(attrAtom, "Should be infallible");
found = mElement->HasAttr(kNameSpaceID_None, attrAtom);