Bug 1359653: Part 3 - Add a clear() method and move asssignment operator to AutoCleanLinkedList. r=waldo
authorKris Maglione <maglione.k@gmail.com>
Tue, 02 May 2017 17:54:18 -0700
changeset 407428 9ddbf855c3d64baf3eb7de327088e99fd345e586
parent 407427 4303fccdaea09a9acf0d72d03e1d3060e20d43ca
child 407429 6dcce95e536b33505ebf0cb2be0e175066e522f2
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 */