summaryrefslogtreecommitdiff
path: root/dom/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-06-13 08:17:56 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-06-13 08:17:56 -0400
commitdd71cefbc0b3d93159625076bdfea1e9823dd803 (patch)
tree4f594882ff55ed9ada940129f83fb6c2c6ff5b0b /dom/base
parent9f400c03579e6794de651f968ecdf5aafaaedea8 (diff)
downloaduxp-dd71cefbc0b3d93159625076bdfea1e9823dd803.tar.gz
Bug 1217436 - Make nsIdentifierMapEntry::mIdContentList an AutoTArray to save an allocation
Tag mcp-graveyard/UXP#1375
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsIdentifierMapEntry.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/dom/base/nsIdentifierMapEntry.h b/dom/base/nsIdentifierMapEntry.h
index fce506cef3..ea60d33221 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;