bug 1049758 - fixup copy and move ctors for children iterators r=wchen
☠☠ backed out by 156f1bee4139 ☠ ☠
authorTrevor Saunders <trev.saunders@gmail.com>
Wed, 06 Aug 2014 14:21:28 -0400
changeset 223126 59f193167901415b085800cb21039f45b2429d74
parent 223125 ab7a4493f8adab6287d370523d8e1b12d7f22849
child 223127 bb3d4bac74685780731e1139cb4728ac2475f36e
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswchen
bugs1049758
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1049758 - fixup copy and move ctors for children iterators r=wchen
content/base/src/ChildIterator.h
--- a/content/base/src/ChildIterator.h
+++ b/content/base/src/ChildIterator.h
@@ -39,16 +39,30 @@ public:
     : mParent(aParent),
       mChild(nullptr),
       mDefaultChild(nullptr),
       mIndexInInserted(0),
       mIsFirst(aStartAtBeginning)
   {
   }
 
+  ExplicitChildIterator(const ExplicitChildIterator& aOther)
+    : mParent(aOther.mParent), mChild(aOther.mChild),
+      mDefaultChild(aOther.mDefaultChild),
+      mShadowIterator(aOther.mShadowIterator ?
+                      new ExplicitChildIterator(*aOther.mShadowIterator) :
+                      nullptr),
+      mIndexInInserted(aOther.mIndexInInserted), mIsFirst(aOther.mIsFirst) {}
+
+  ExplicitChildIterator(ExplicitChildIterator&& aOther)
+    : mParent(aOther.mParent), mChild(aOther.mChild),
+      mDefaultChild(aOther.mDefaultChild),
+      mShadowIterator(Move(aOther.mShadowIterator)),
+      mIndexInInserted(aOther.mIndexInInserted), mIsFirst(aOther.mIsFirst) {}
+
   nsIContent* GetNextChild();
 
   // Looks for aChildToFind respecting insertion points until aChildToFind
   // or aBound is found. If aBound is nullptr then the seek is unbounded. Returns
   // whether aChildToFind was found as an explicit child prior to encountering
   // aBound.
   bool Seek(nsIContent* aChildToFind, nsIContent* aBound = nullptr)
   {
@@ -113,25 +127,31 @@ class FlattenedChildIterator : public Ex
 {
 public:
   FlattenedChildIterator(nsIContent* aParent)
     : ExplicitChildIterator(aParent), mXBLInvolved(false)
   {
     Init(false);
   }
 
+  FlattenedChildIterator(FlattenedChildIterator&& aOther)
+    : ExplicitChildIterator(Move(aOther)), mXBLInvolved(aOther.mXBLInvolved) {}
+
+  FlattenedChildIterator(const FlattenedChildIterator& aOther)
+    : ExplicitChildIterator(aOther), mXBLInvolved(aOther.mXBLInvolved) {}
+
   bool XBLInvolved() { return mXBLInvolved; }
 
 protected:
   /**
    * This constructor is a hack to help AllChildrenIterator which sometimes
    * doesn't want to consider XBL.
    */
   FlattenedChildIterator(nsIContent* aParent, bool aIgnoreXBL)
-  : ExplicitChildIterator(aParent), mXBLInvolved(false)
+    : ExplicitChildIterator(aParent), mXBLInvolved(false)
   {
     Init(aIgnoreXBL);
   }
 
   void Init(bool aIgnoreXBL);
 
   // For certain optimizations, nsCSSFrameConstructor needs to know if the
   // child list of the element that we're iterating matches its .childNodes.
@@ -147,16 +167,22 @@ protected:
 class AllChildrenIterator : private FlattenedChildIterator
 {
 public:
   AllChildrenIterator(nsIContent* aNode, uint32_t aFlags) :
     FlattenedChildIterator(aNode, (aFlags & nsIContent::eAllButXBL)),
     mOriginalContent(aNode), mFlags(aFlags),
     mPhase(eNeedBeforeKid) {}
 
+  AllChildrenIterator(AllChildrenIterator&& aOther)
+    : FlattenedChildIterator(Move(aOther)),
+      mOriginalContent(aOther.mOriginalContent),
+      mAnonKids(Move(aOther.mAnonKids)), mFlags(aOther.mFlags),
+      mPhase(aOther.mPhase), mMutationGuard(aOther.mMutationGuard) {}
+
 #ifdef DEBUG
   ~AllChildrenIterator() { MOZ_ASSERT(!mMutationGuard.Mutated(0)); }
 #endif
 
   nsIContent* GetNextChild();
 
 private:
   enum IteratorPhase