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

@@ -258,7 +258,7 @@ TableRowsCollection::GetFirstNamedElement(const nsAString& aName, bool& aFound)
{
EnsureInitialized();
aFound = false;
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
RefPtr<nsIAtom> nameAtom = NS_Atomize(aName);
NS_ENSURE_TRUE(nameAtom, nullptr);
for (auto& node : mRows) {