Bug 1289211 - Rename InfallibleTArray to nsTArray in xpcom/ r=erahm
authorBarret Rennie <barret@brennie.ca>
Wed, 10 Jul 2019 03:33:59 +0000
changeset 482227 c8c9a4b6034d9decbc888d78b7426325f49a08ee
parent 482226 ddbf599fa85804c64acd157402f9cd44f20a3a4b
child 482228 7af637f381fab7d3ee6d0dca01c0ef547cdced79
push id113654
push useraiakab@mozilla.com
push dateWed, 10 Jul 2019 22:00:37 +0000
treeherdermozilla-inbound@8c710c79d4a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1289211
milestone70.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 1289211 - Rename InfallibleTArray to nsTArray in xpcom/ r=erahm Differential Revision: https://phabricator.services.mozilla.com/D36970
xpcom/ds/nsTArray.h
xpcom/io/nsMultiplexInputStream.cpp
xpcom/tests/gtest/TestTArray2.cpp
--- a/xpcom/ds/nsTArray.h
+++ b/xpcom/ds/nsTArray.h
@@ -922,17 +922,17 @@ class nsTArray_Impl
   // Allow converting to a const array with a different kind of allocator,
   // Since the allocator doesn't matter for const arrays
   template <typename Allocator>
   operator const nsTArray_Impl<E, Allocator>&() const {
     return *reinterpret_cast<const nsTArray_Impl<E, Allocator>*>(this);
   }
   // And we have to do this for our subclasses too
   operator const nsTArray<E>&() const {
-    return *reinterpret_cast<const InfallibleTArray<E>*>(this);
+    return *reinterpret_cast<const nsTArray<E>*>(this);
   }
   operator const FallibleTArray<E>&() const {
     return *reinterpret_cast<const FallibleTArray<E>*>(this);
   }
 
   // The array's assignment operator performs a 'deep' copy of the given
   // array.  It is optimized to reuse existing storage if possible.
   // @param aOther The array object to copy.
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -1034,17 +1034,17 @@ void nsMultiplexInputStream::SerializeIn
 
   MultiplexInputStreamParams params;
 
   CheckedUint32 totalSizeUsed = 0;
   CheckedUint32 maxSize = aMaxSize;
 
   uint32_t streamCount = mStreams.Length();
   if (streamCount) {
-    InfallibleTArray<InputStreamParams>& streams = params.streams();
+    nsTArray<InputStreamParams>& streams = params.streams();
 
     streams.SetCapacity(streamCount);
     for (uint32_t index = 0; index < streamCount; index++) {
       uint32_t sizeUsed = 0;
       InputStreamParams childStreamParams;
       InputStreamHelper::SerializeInputStream(
           mStreams[index].mStream, childStreamParams, aFileDescriptors,
           aDelayedStart, maxSize.value(), &sizeUsed, aManager);
@@ -1076,17 +1076,17 @@ bool nsMultiplexInputStream::Deserialize
   if (aParams.type() != InputStreamParams::TMultiplexInputStreamParams) {
     NS_ERROR("Received unknown parameters from the other process!");
     return false;
   }
 
   const MultiplexInputStreamParams& params =
       aParams.get_MultiplexInputStreamParams();
 
-  const InfallibleTArray<InputStreamParams>& streams = params.streams();
+  const nsTArray<InputStreamParams>& streams = params.streams();
 
   uint32_t streamCount = streams.Length();
   for (uint32_t index = 0; index < streamCount; index++) {
     nsCOMPtr<nsIInputStream> stream = InputStreamHelper::DeserializeInputStream(
         streams[index], aFileDescriptors);
     if (!stream) {
       NS_WARNING("Deserialize failed!");
       return false;
--- a/xpcom/tests/gtest/TestTArray2.cpp
+++ b/xpcom/tests/gtest/TestTArray2.cpp
@@ -986,111 +986,96 @@ TEST(TArray, test_fallible)
 }
 #endif
 
 TEST(TArray, test_conversion_operator)
 {
   FallibleTArray<int> f;
   const FallibleTArray<int> fconst;
 
-  InfallibleTArray<int> i;
-  const InfallibleTArray<int> iconst;
-
   nsTArray<int> t;
   const nsTArray<int> tconst;
   AutoTArray<int, 8> tauto;
   const AutoTArray<int, 8> tautoconst;
 
 #define CHECK_ARRAY_CAST(type)                  \
   do {                                          \
     const type<int>& z1 = f;                    \
     ASSERT_EQ((void*)&z1, (void*)&f);           \
     const type<int>& z2 = fconst;               \
     ASSERT_EQ((void*)&z2, (void*)&fconst);      \
-    const type<int>& z5 = i;                    \
-    ASSERT_EQ((void*)&z5, (void*)&i);           \
-    const type<int>& z6 = iconst;               \
-    ASSERT_EQ((void*)&z6, (void*)&iconst);      \
     const type<int>& z9 = t;                    \
     ASSERT_EQ((void*)&z9, (void*)&t);           \
     const type<int>& z10 = tconst;              \
     ASSERT_EQ((void*)&z10, (void*)&tconst);     \
     const type<int>& z11 = tauto;               \
     ASSERT_EQ((void*)&z11, (void*)&tauto);      \
     const type<int>& z12 = tautoconst;          \
     ASSERT_EQ((void*)&z12, (void*)&tautoconst); \
   } while (0)
 
   CHECK_ARRAY_CAST(FallibleTArray);
-  CHECK_ARRAY_CAST(InfallibleTArray);
   CHECK_ARRAY_CAST(nsTArray);
 
 #undef CHECK_ARRAY_CAST
 }
 
 template <class T>
 struct BufAccessor : public T {
   void* GetHdr() { return T::mHdr; }
 };
 
 TEST(TArray, test_SetLengthAndRetainStorage_no_ctor)
 {
   // 1050 because sizeof(int)*1050 is more than a page typically.
   const int N = 1050;
   FallibleTArray<int> f;
 
-  InfallibleTArray<int> i;
-
   nsTArray<int> t;
   AutoTArray<int, N> tauto;
 
 #define LPAREN (
 #define RPAREN )
 #define FOR_EACH(pre, post) \
   do {                      \
     pre f post;             \
-    pre i post;             \
     pre t post;             \
     pre tauto post;         \
   } while (0)
 
   // Setup test arrays.
   FOR_EACH(; Unused <<, .SetLength(N, fallible));
   for (int n = 0; n < N; ++n) {
     FOR_EACH(;, [n] = n);
   }
 
   void* initial_Hdrs[] = {
       static_cast<BufAccessor<FallibleTArray<int> >&>(f).GetHdr(),
-      static_cast<BufAccessor<InfallibleTArray<int> >&>(i).GetHdr(),
       static_cast<BufAccessor<nsTArray<int> >&>(t).GetHdr(),
       static_cast<BufAccessor<AutoTArray<int, N> >&>(tauto).GetHdr(), nullptr};
 
   // SetLengthAndRetainStorage(n), should NOT overwrite memory when T hasn't
   // a default constructor.
   FOR_EACH(;, .SetLengthAndRetainStorage(8));
   FOR_EACH(;, .SetLengthAndRetainStorage(12));
   for (int n = 0; n < 12; ++n) {
     ASSERT_EQ(f[n], n);
-    ASSERT_EQ(i[n], n);
     ASSERT_EQ(t[n], n);
     ASSERT_EQ(tauto[n], n);
   }
   FOR_EACH(;, .SetLengthAndRetainStorage(0));
   FOR_EACH(;, .SetLengthAndRetainStorage(N));
   for (int n = 0; n < N; ++n) {
     ASSERT_EQ(f[n], n);
-    ASSERT_EQ(i[n], n);
     ASSERT_EQ(t[n], n);
     ASSERT_EQ(tauto[n], n);
   }
 
   void* current_Hdrs[] = {
       static_cast<BufAccessor<FallibleTArray<int> >&>(f).GetHdr(),
-      static_cast<BufAccessor<InfallibleTArray<int> >&>(i).GetHdr(),
       static_cast<BufAccessor<nsTArray<int> >&>(t).GetHdr(),
       static_cast<BufAccessor<AutoTArray<int, N> >&>(tauto).GetHdr(), nullptr};
 
   // SetLengthAndRetainStorage(n) should NOT have reallocated the internal
   // memory.
   ASSERT_EQ(sizeof(initial_Hdrs), sizeof(current_Hdrs));
   for (size_t n = 0; n < sizeof(current_Hdrs) / sizeof(current_Hdrs[0]); ++n) {
     ASSERT_EQ(current_Hdrs[n], initial_Hdrs[n]);