Bug 1311277 Part 4 - Convert NodeKind to be an enum class. draft
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 20 Oct 2016 17:01:11 +0800
changeset 427906 25729537a35661ca01802cee8da59c38eabdbe1a
parent 427905 0bb8470f53174e4a1f8196f2433576846f1e1801
child 534591 b03f9227e0cef6177306619a8d25e48f5842d3d9
push id33159
push userbmo:tlin@mozilla.com
push dateFri, 21 Oct 2016 03:26:06 +0000
bugs1311277
milestone52.0a1
Bug 1311277 Part 4 - Convert NodeKind to be an enum class. MozReview-Commit-ID: 2APdWxa8rZ6
mfbt/LinkedList.h
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -217,25 +217,25 @@ public:
   {
     MOZ_ASSERT((mNext == this) == (mPrev == this));
     return mNext != this;
   }
 
 private:
   friend class LinkedList<T>;
 
-  enum NodeKind {
-    NODE_KIND_NORMAL,
-    NODE_KIND_SENTINEL
+  enum class NodeKind {
+    Normal,
+    Sentinel
   };
 
   explicit LinkedListElement(NodeKind nodeKind)
     : mNext(this),
       mPrev(this),
-      mIsSentinel(nodeKind == NODE_KIND_SENTINEL)
+      mIsSentinel(nodeKind == NodeKind::Sentinel)
   { }
 
   /*
    * Return |this| cast to T* if we're a normal node, or return nullptr if
    * we're a sentinel node.
    */
   T* asT()
   {
@@ -335,17 +335,17 @@ public:
       return *this;
     }
 
     bool operator!=(Iterator& aOther) const {
       return mCurrent != aOther.mCurrent;
     }
   };
 
-  LinkedList() : sentinel(LinkedListElement<T>::NODE_KIND_SENTINEL) { }
+  LinkedList() : sentinel(LinkedListElement<T>::NodeKind::Sentinel) { }
 
   LinkedList(LinkedList<T>&& aOther)
     : sentinel(mozilla::Move(aOther.sentinel))
   { }
 
   LinkedList& operator=(LinkedList<T>&& aOther)
   {
     MOZ_ASSERT(isEmpty(), "Assigning to a non-empty list leaks elements in that list!");