Bug 1251723 - remove ScopedDeletePtr; r=Waldo
authorNathan Froyd <froydnj@mozilla.com>
Fri, 26 Feb 2016 15:08:03 -0500
changeset 323045 1b90b677dab337321e0311348397c6c69a3ff002
parent 323044 7209701f89750cdff597a4a9ff2656385a63d9a6
child 323046 6fa89bbe833b9baeb2ecac29fe3aeeb80563e042
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)
reviewersWaldo
bugs1251723
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 1251723 - remove ScopedDeletePtr; r=Waldo UniquePtr is more standard than ScopedDeletePtr; using standard constructs whenever possible is preferable.
mfbt/Scoped.h
--- a/mfbt/Scoped.h
+++ b/mfbt/Scoped.h
@@ -18,19 +18,18 @@
  * propagated.  The Scoped* classes defined in this header perform the
  * deallocation of the resource they hold once program execution
  * reaches the end of the scope for which they have been defined.
  *
  * This header provides the following RAII classes:
  *
  * - |ScopedFreePtr| - a container for a pointer, that automatically calls
  *   |free()| at the end of the scope;
- * - |ScopedDeletePtr| - a container for a pointer, that automatically calls
- *   |delete| at the end of the scope;
  *
+ * |ScopedDeletePtr| is removed in favor of |UniquePtr<T>|.
  * |ScopedDeleteArray| is removed in favor of |UniquePtr<T[]>|.
  *
  * The general scenario for each of the RAII classes is the following:
  *
  * ScopedClass foo(create_value());
  * // ... In this scope, |foo| is defined. Use |foo.get()| or |foo.rwget()|
  *        to access the value.
  * // ... In case of |return| or |throw|, |foo| is deallocated automatically.
@@ -231,29 +230,16 @@ struct ScopedFreePtrTraits
 {
   typedef T* type;
   static T* empty() { return nullptr; }
   static void release(T* aPtr) { free(aPtr); }
 };
 SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits)
 
 /*
- * ScopedDeletePtr is a RAII wrapper for pointers that need to be deleted.
- *
- *   struct S { ... };
- *   ScopedDeletePtr<S> foo = new S();
- */
-template<typename T>
-struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T>
-{
-  static void release(T* aPtr) { delete aPtr; }
-};
-SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits)
-
-/*
  * MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE makes it easy to create scoped
  * pointers for types with custom deleters; just overload
  * TypeSpecificDelete(T*) in the same namespace as T to call the deleter for
  * type T.
  *
  * @param name The name of the class to define.
  * @param Type A struct implementing clean-up. See the implementations
  * for more details.