Bug 1250196 - Part 2: Rename UniquePtr::getDeleter() to get_deleter() in order to make it compatible with std::unique_ptr; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 22 Feb 2016 11:54:36 -0500
changeset 321405 aab8109b413262c1976debe0e9fbea534093eccc
parent 321404 390c755ec4b3528b501f3155f56a1860bdbbada0
child 321406 6132ec9304462a131961394de10d52b335976c61
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1250196
milestone47.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 1250196 - Part 2: Rename UniquePtr::getDeleter() to get_deleter() in order to make it compatible with std::unique_ptr; r=froydnj
mfbt/UniquePtr.h
mfbt/tests/TestUniquePtr.cpp
--- a/mfbt/UniquePtr.h
+++ b/mfbt/UniquePtr.h
@@ -221,17 +221,17 @@ public:
             typename RemoveReference<D>::Type&& aD2)
     : mTuple(aPtr, Move(aD2))
   {
     static_assert(!IsReference<D>::value,
                   "rvalue deleter can't be stored by reference");
   }
 
   UniquePtr(UniquePtr&& aOther)
-    : mTuple(aOther.release(), Forward<DeleterType>(aOther.getDeleter()))
+    : mTuple(aOther.release(), Forward<DeleterType>(aOther.get_deleter()))
   {}
 
   MOZ_IMPLICIT
   UniquePtr(decltype(nullptr))
     : mTuple(nullptr, DeleterType())
   {
     static_assert(!IsPointer<D>::value, "must provide a deleter instance");
     static_assert(!IsReference<D>::value, "must provide a deleter instance");
@@ -242,40 +242,40 @@ public:
   UniquePtr(UniquePtr<U, E>&& aOther,
             typename EnableIf<IsConvertible<typename UniquePtr<U, E>::Pointer,
                                             Pointer>::value &&
                               !IsArray<U>::value &&
                               (IsReference<D>::value
                                ? IsSame<D, E>::value
                                : IsConvertible<E, D>::value),
                               int>::Type aDummy = 0)
-    : mTuple(aOther.release(), Forward<E>(aOther.getDeleter()))
+    : mTuple(aOther.release(), Forward<E>(aOther.get_deleter()))
   {
   }
 
   ~UniquePtr() { reset(nullptr); }
 
   UniquePtr& operator=(UniquePtr&& aOther)
   {
     reset(aOther.release());
-    getDeleter() = Forward<DeleterType>(aOther.getDeleter());
+    get_deleter() = Forward<DeleterType>(aOther.get_deleter());
     return *this;
   }
 
   template<typename U, typename E>
   UniquePtr& operator=(UniquePtr<U, E>&& aOther)
   {
     static_assert(IsConvertible<typename UniquePtr<U, E>::Pointer,
                                 Pointer>::value,
                   "incompatible UniquePtr pointees");
     static_assert(!IsArray<U>::value,
                   "can't assign from UniquePtr holding an array");
 
     reset(aOther.release());
-    getDeleter() = Forward<E>(aOther.getDeleter());
+    get_deleter() = Forward<E>(aOther.get_deleter());
     return *this;
   }
 
   UniquePtr& operator=(decltype(nullptr))
   {
     reset(nullptr);
     return *this;
   }
@@ -286,32 +286,32 @@ public:
     MOZ_ASSERT(get(), "dereferencing a UniquePtr containing nullptr");
     return get();
   }
 
   explicit operator bool() const { return get() != nullptr; }
 
   Pointer get() const { return ptr(); }
 
-  DeleterType& getDeleter() { return del(); }
-  const DeleterType& getDeleter() const { return del(); }
+  DeleterType& get_deleter() { return del(); }
+  const DeleterType& get_deleter() const { return del(); }
 
   MOZ_WARN_UNUSED_RESULT Pointer release()
   {
     Pointer p = ptr();
     ptr() = nullptr;
     return p;
   }
 
   void reset(Pointer aPtr = Pointer())
   {
     Pointer old = ptr();
     ptr() = aPtr;
     if (old != nullptr) {
-      getDeleter()(old);
+      get_deleter()(old);
     }
   }
 
   void swap(UniquePtr& aOther)
   {
     mTuple.swap(aOther.mTuple);
   }
 
@@ -390,49 +390,49 @@ public:
   template<typename U, typename V>
   UniquePtr(U&& aU, V&& aV,
             typename EnableIf<IsPointer<U>::value &&
                               IsConvertible<U, Pointer>::value,
                               int>::Type aDummy = 0)
   = delete;
 
   UniquePtr(UniquePtr&& aOther)
-    : mTuple(aOther.release(), Forward<DeleterType>(aOther.getDeleter()))
+    : mTuple(aOther.release(), Forward<DeleterType>(aOther.get_deleter()))
   {}
 
   MOZ_IMPLICIT
   UniquePtr(decltype(nullptr))
     : mTuple(nullptr, DeleterType())
   {
     static_assert(!IsPointer<D>::value, "must provide a deleter instance");
     static_assert(!IsReference<D>::value, "must provide a deleter instance");
   }
 
   ~UniquePtr() { reset(nullptr); }
 
   UniquePtr& operator=(UniquePtr&& aOther)
   {
     reset(aOther.release());
-    getDeleter() = Forward<DeleterType>(aOther.getDeleter());
+    get_deleter() = Forward<DeleterType>(aOther.get_deleter());
     return *this;
   }
 
   UniquePtr& operator=(decltype(nullptr))
   {
     reset();
     return *this;
   }
 
   explicit operator bool() const { return get() != nullptr; }
 
   T& operator[](decltype(sizeof(int)) aIndex) const { return get()[aIndex]; }
   Pointer get() const { return mTuple.first(); }
 
-  DeleterType& getDeleter() { return mTuple.second(); }
-  const DeleterType& getDeleter() const { return mTuple.second(); }
+  DeleterType& get_deleter() { return mTuple.second(); }
+  const DeleterType& get_deleter() const { return mTuple.second(); }
 
   MOZ_WARN_UNUSED_RESULT Pointer release()
   {
     Pointer p = mTuple.first();
     mTuple.first() = nullptr;
     return p;
   }
 
--- a/mfbt/tests/TestUniquePtr.cpp
+++ b/mfbt/tests/TestUniquePtr.cpp
@@ -287,17 +287,17 @@ static bool
 TestReferenceDeleterGuts()
 {
   DefaultDelete<int> delInt;
   IntDeleterRef id1(new int, delInt);
 
   IntDeleterRef id2(Move(id1));
   CHECK(id1 == nullptr);
   CHECK(nullptr != id2);
-  CHECK(&id1.getDeleter() == &id2.getDeleter());
+  CHECK(&id1.get_deleter() == &id2.get_deleter());
 
   IntDeleterRef id3(Move(id2));
 
   DefaultDelete<A> delA;
   ADeleterRef a1(new A, delA);
   a1.reset(nullptr);
   a1.reset(new B);
   a1 = nullptr;