Bug 1235261 - Part 4: Remove AutoFallibleTArray. r=froydnj

This commit is contained in:
Birunthan Mohanathas 2016-01-31 17:12:12 +02:00
parent fefae7df1f
commit c4a964ab81
5 changed files with 4 additions and 72 deletions

View File

@ -101,6 +101,5 @@ def init(debugger):
debugger.HandleCommand("type synthetic add -x \"nsTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider")
debugger.HandleCommand("type synthetic add -x \"AutoTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider")
debugger.HandleCommand("type synthetic add -x \"FallibleTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider")
debugger.HandleCommand("type synthetic add -x \"AutoFallibleTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider")
debugger.HandleCommand("command script add -f lldbutils.general.prefcnt -f lldbutils.general.prefcnt prefcnt")
debugger.HandleCommand("command script add -f lldbutils.general.callfunc -f lldbutils.general.callfunc callfunc")

View File

@ -53,13 +53,9 @@ struct TileClient;
// nsTArray<T>,
// FallibleTArray<T>,
// AutoTArray<T, N>, and
// AutoFallibleTArray<T, N>.
//
// nsTArray and AutoTArray are infallible; if one tries to make an allocation
// which fails, it crashes the program. In contrast, FallibleTArray and
// AutoFallibleTArray are fallible; if you use one of these classes, you must
// check the return values of methods such as Append() which may allocate. If
// in doubt, choose an infallible type.
// nsTArray and AutoTArray are infallible by default. To opt-in to fallible
// behaviour, use the `mozilla::fallible` parameter and check the return value.
//
// InfallibleTArray and AutoInfallibleTArray are aliases for nsTArray and
// AutoTArray.
@ -786,7 +782,7 @@ struct ItemComparatorFirstElementGT
//
// nsTArray_Impl contains most of the guts supporting nsTArray, FallibleTArray,
// AutoTArray, and AutoFallibleTArray.
// AutoTArray.
//
// The only situation in which you might need to use nsTArray_Impl in your code
// is if you're writing code which mutates a TArray which may or may not be
@ -2205,7 +2201,7 @@ public:
};
//
// nsAutoArrayBase is a base class for AutoFallibleTArray and AutoTArray.
// nsAutoArrayBase is a base class for AutoTArray.
// You shouldn't use this class directly.
//
template<class TArrayBase, size_t N>
@ -2311,9 +2307,6 @@ class nsAutoArrayBase<TArrayBase, 0> : public TArrayBase
// storage. If you try to store more than N elements inside an
// AutoTArray<E, N>, we'll call malloc() and store them all on the heap.
//
// Note that you can cast an AutoTArray<E, N> to
// |const AutoFallibleTArray<E, N>&|.
//
template<class E, size_t N>
class AutoTArray : public nsAutoArrayBase<nsTArray<E>, N>
{
@ -2340,48 +2333,6 @@ public:
Base::operator=(other);
return *this;
}
operator const AutoFallibleTArray<E, N>&() const
{
return *reinterpret_cast<const AutoFallibleTArray<E, N>*>(this);
}
};
//
// AutoFallibleTArray<E, N> is a fallible vector class with N elements of
// inline storage.
//
template<class E, size_t N>
class AutoFallibleTArray : public nsAutoArrayBase<FallibleTArray<E>, N>
{
typedef AutoFallibleTArray<E, N> self_type;
typedef nsAutoArrayBase<FallibleTArray<E>, N> Base;
public:
AutoFallibleTArray() {}
template<typename Allocator>
explicit AutoFallibleTArray(const nsTArray_Impl<E, Allocator>& aOther)
{
Base::AppendElements(aOther);
}
template<typename Allocator>
explicit AutoFallibleTArray(nsTArray_Impl<E, Allocator>&& aOther)
: Base(mozilla::Move(aOther))
{
}
template<typename Allocator>
self_type& operator=(const nsTArray_Impl<E, Allocator>& other)
{
Base::operator=(other);
return *this;
}
operator const AutoTArray<E, N>&() const
{
return *reinterpret_cast<const AutoTArray<E, N>*>(this);
}
};
template<class E, size_t N>

View File

@ -30,9 +30,6 @@ class FallibleTArray;
template<class E, size_t N>
class AutoTArray;
template<class E, size_t N>
class AutoFallibleTArray;
#define InfallibleTArray nsTArray
#define AutoInfallibleTArray AutoTArray

View File

@ -119,11 +119,6 @@ CreateGlobalAndRunTest(JSRuntime* rt, JSContext* cx)
RunTest(rt, cx, &array);
}
{
AutoFallibleTArray<ElementT, InitialElements> array;
RunTest(rt, cx, &array);
}
JS_LeaveCompartment(cx, oldCompartment);
}

View File

@ -1037,8 +1037,6 @@ static bool test_fallible()
static bool test_conversion_operator() {
FallibleTArray<int> f;
const FallibleTArray<int> fconst;
AutoFallibleTArray<int, 8> fauto;
const AutoFallibleTArray<int, 8> fautoconst;
InfallibleTArray<int> i;
const InfallibleTArray<int> iconst;
@ -1056,10 +1054,6 @@ static bool test_conversion_operator() {
if ((void*)&z1 != (void*)&f) return false; \
const type<int>& z2 = fconst; \
if ((void*)&z2 != (void*)&fconst) return false; \
const type<int>& z3 = fauto; \
if ((void*)&z3 != (void*)&fauto) return false; \
const type<int>& z4 = fautoconst; \
if ((void*)&z4 != (void*)&fautoconst) return false; \
const type<int>& z5 = i; \
if ((void*)&z5 != (void*)&i) return false; \
const type<int>& z6 = iconst; \
@ -1097,7 +1091,6 @@ static bool test_SetLengthAndRetainStorage_no_ctor() {
// 1050 because sizeof(int)*1050 is more than a page typically.
const int N = 1050;
FallibleTArray<int> f;
AutoFallibleTArray<int, N> fauto;
InfallibleTArray<int> i;
AutoInfallibleTArray<int, N> iauto;
@ -1110,7 +1103,6 @@ static bool test_SetLengthAndRetainStorage_no_ctor() {
#define FOR_EACH(pre, post) \
do { \
pre f post; \
pre fauto post; \
pre i post; \
pre iauto post; \
pre t post; \
@ -1125,7 +1117,6 @@ static bool test_SetLengthAndRetainStorage_no_ctor() {
void* initial_Hdrs[] = {
static_cast<BufAccessor<FallibleTArray<int> >&>(f).GetHdr(),
static_cast<BufAccessor<AutoFallibleTArray<int, N> >&>(fauto).GetHdr(),
static_cast<BufAccessor<InfallibleTArray<int> >&>(i).GetHdr(),
static_cast<BufAccessor<AutoInfallibleTArray<int, N> >&>(iauto).GetHdr(),
static_cast<BufAccessor<nsTArray<int> >&>(t).GetHdr(),
@ -1148,7 +1139,6 @@ static bool test_SetLengthAndRetainStorage_no_ctor() {
void* current_Hdrs[] = {
static_cast<BufAccessor<FallibleTArray<int> >&>(f).GetHdr(),
static_cast<BufAccessor<AutoFallibleTArray<int, N> >&>(fauto).GetHdr(),
static_cast<BufAccessor<InfallibleTArray<int> >&>(i).GetHdr(),
static_cast<BufAccessor<AutoInfallibleTArray<int, N> >&>(iauto).GetHdr(),
static_cast<BufAccessor<nsTArray<int> >&>(t).GetHdr(),