Bug 1277890 - part 1 - avoid unnecessary refcounting when building the filters list; r=baku
authorNathan Froyd <froydnj@gmail.com>
Tue, 07 Jun 2016 04:10:25 -0400
changeset 376153 f7f9ed4d698450254ed5c79798392bb75a43d325
parent 376152 24cb98ca61eae5629a28333cbd6e4fa22fc34a4f
child 376154 93800cba65b28bd9f77c3e7b46cd681049b63743
push id20510
push usercholler@mozilla.com
push dateTue, 07 Jun 2016 13:42:30 +0000
reviewersbaku
bugs1277890
milestone49.0a1
Bug 1277890 - part 1 - avoid unnecessary refcounting when building the filters list; r=baku We can pass the atom reference we have into the filter list, there's no need for the filter list to retain a separate reference of the atom.
dom/base/nsDOMMutationObserver.cpp
--- a/dom/base/nsDOMMutationObserver.cpp
+++ b/dom/base/nsDOMMutationObserver.cpp
@@ -680,18 +680,17 @@ nsDOMMutationObserver::Observe(nsINode& 
   if (aOptions.mAttributeFilter.WasPassed()) {
     allAttrs = false;
     const mozilla::dom::Sequence<nsString>& filtersAsString =
       aOptions.mAttributeFilter.Value();
     uint32_t len = filtersAsString.Length();
     filters.SetCapacity(len);
 
     for (uint32_t i = 0; i < len; ++i) {
-      nsCOMPtr<nsIAtom> a = NS_Atomize(filtersAsString[i]);
-      filters.AppendObject(a);
+      filters.AppendElement(NS_Atomize(filtersAsString[i]));
     }
   }
 
   nsMutationReceiver* r = GetReceiverFor(&aTarget, true, animations);
   r->SetChildList(childList);
   r->SetAttributes(attributes);
   r->SetCharacterData(characterData);
   r->SetSubtree(subtree);