From a4c5e74b0b48ade0c1b50b3905670a9d86422453 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 13 Jun 2020 08:17:56 -0400 Subject: Bug 1217436 - Make nsIdentifierMapEntry::mIdContentList an AutoTArray to save an allocation Tag #1375 --- dom/base/nsIdentifierMapEntry.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'dom') diff --git a/dom/base/nsIdentifierMapEntry.h b/dom/base/nsIdentifierMapEntry.h index fce506cef..ea60d3322 100644 --- a/dom/base/nsIdentifierMapEntry.h +++ b/dom/base/nsIdentifierMapEntry.h @@ -54,13 +54,18 @@ public: nsStringHashKey(aKey), mNameContentList(nullptr) { } - nsIdentifierMapEntry(const nsIdentifierMapEntry& aOther) : - nsStringHashKey(&aOther.GetKey()) + nsIdentifierMapEntry(nsIdentifierMapEntry&& aOther) : + nsStringHashKey(&aOther.GetKey()), + mIdContentList(mozilla::Move(aOther.mIdContentList)), + mNameContentList(aOther.mNameContentList.forget()), + mChangeCallbacks(aOther.mChangeCallbacks.forget()), + mImageElement(aOther.mImageElement.forget()) { - NS_ERROR("Should never be called"); } ~nsIdentifierMapEntry(); + enum { ALLOW_MEMMOVE = false }; + void AddNameElement(nsINode* aDocument, Element* aElement); void RemoveNameElement(Element* aElement); bool IsEmpty(); @@ -156,12 +161,15 @@ public: size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: + nsIdentifierMapEntry(const nsIdentifierMapEntry& aOther) = delete; + nsIdentifierMapEntry& operator=(const nsIdentifierMapEntry& aOther) = delete; + void FireChangeCallbacks(Element* aOldElement, Element* aNewElement, bool aImageOnly = false); // empty if there are no elements with this ID. // The elements are stored as weak pointers. - nsTArray mIdContentList; + AutoTArray mIdContentList; RefPtr mNameContentList; nsAutoPtr > mChangeCallbacks; RefPtr mImageElement; -- cgit v1.2.3