Bug 1037103 - Remove ScopedDeleteArray from Scoped.h. r=jcranmer
authorJeff Walden <jwalden@mit.edu>
Thu, 10 Jul 2014 17:43:59 -0700
changeset 220445 e2044e4fd875759d3eb8b019cc03f1fda42636d1
parent 220444 493ef0c346acf83a40916602cd7abf940c137538
child 220446 049a6a780ecd443096585d75b3cdda33db6a5e81
push id583
push userbhearsum@mozilla.com
push dateMon, 24 Nov 2014 19:04:58 +0000
treeherdermozilla-release@c107e74250f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1037103
milestone34.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 1037103 - Remove ScopedDeleteArray from Scoped.h. r=jcranmer
mfbt/Scoped.h
--- a/mfbt/Scoped.h
+++ b/mfbt/Scoped.h
@@ -20,18 +20,18 @@
  * 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;
- * - |ScopedDeleteArray| - a container for a pointer to an array, that
- *   automatically calls |delete[]| at the end of the scope.
+ *
+ * |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.
  * // ... If |foo| needs to be returned or stored, use |foo.forget()|
@@ -245,29 +245,16 @@ SCOPED_TEMPLATE(ScopedFreePtr, ScopedFre
 template<typename T>
 struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T>
 {
   static void release(T* aPtr) { delete aPtr; }
 };
 SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits)
 
 /*
- * ScopedDeleteArray is a RAII wrapper for pointers that need to be delete[]ed.
- *
- *   struct S { ... };
- *   ScopedDeleteArray<S> foo = new S[42];
- */
-template<typename T>
-struct ScopedDeleteArrayTraits : public ScopedFreePtrTraits<T>
-{
-  static void release(T* aPtr) { delete [] aPtr; }
-};
-SCOPED_TEMPLATE(ScopedDeleteArray, ScopedDeleteArrayTraits)
-
-/*
  * 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.