Bug 1359653: Part 3 - Add a clear() method and move asssignment operator to AutoCleanLinkedList. r=waldo
☠☠ backed out by 3bd8afb673ef ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 02 May 2017 17:54:18 -0700
changeset 407402 b49bd726c8a6e955c672df17b2b9134ab3ad34d5
parent 407401 3f94cd9d95b99436ea5f77aee5d220092b6b32d6
child 407403 16259c1af36e138881d18a3f8b0a803f5d4fc3ec
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1359653
milestone55.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 1359653: Part 3 - Add a clear() method and move asssignment operator to AutoCleanLinkedList. r=waldo MozReview-Commit-ID: 2bUTMPviJzg
mfbt/LinkedList.h
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -643,16 +643,27 @@ private:
 };
 
 template <typename T>
 class AutoCleanLinkedList : public LinkedList<T>
 {
 public:
   ~AutoCleanLinkedList()
   {
+    clear();
+  }
+
+  AutoCleanLinkedList& operator=(AutoCleanLinkedList&& aOther)
+  {
+    LinkedList<T>::operator=(Forward<LinkedList<T>>(aOther));
+    return *this;
+  }
+
+  void clear()
+  {
     while (T* element = this->popFirst()) {
       delete element;
     }
   }
 };
 
 } /* namespace mozilla */