diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:17:56 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-06-13 08:17:56 -0400 |
commit | a4c5e74b0b48ade0c1b50b3905670a9d86422453 (patch) | |
tree | 4f594882ff55ed9ada940129f83fb6c2c6ff5b0b /dom/base/nsIdentifierMapEntry.h | |
parent | 59a5adc93415f6d6e8ce4352ba0cd2d34d5e7888 (diff) | |
download | UXP-a4c5e74b0b48ade0c1b50b3905670a9d86422453.tar UXP-a4c5e74b0b48ade0c1b50b3905670a9d86422453.tar.gz UXP-a4c5e74b0b48ade0c1b50b3905670a9d86422453.tar.lz UXP-a4c5e74b0b48ade0c1b50b3905670a9d86422453.tar.xz UXP-a4c5e74b0b48ade0c1b50b3905670a9d86422453.zip |
Bug 1217436 - Make nsIdentifierMapEntry::mIdContentList an AutoTArray to save an allocation
Tag #1375
Diffstat (limited to 'dom/base/nsIdentifierMapEntry.h')
-rw-r--r-- | dom/base/nsIdentifierMapEntry.h | 16 |
1 files changed, 12 insertions, 4 deletions
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<Element*> mIdContentList; + AutoTArray<Element*, 1> mIdContentList; RefPtr<nsBaseContentList> mNameContentList; nsAutoPtr<nsTHashtable<ChangeCallbackEntry> > mChangeCallbacks; RefPtr<Element> mImageElement; |