Bug 1269365 - Part 1 - Swap fallible and infallible TArray ParamTraits. r=froydnj, a=ritu
authorAndrew McCreight <continuation@gmail.com>
Tue, 03 May 2016 09:29:39 -0700
changeset 332831 3aa4f99aeb0e022e47cbb26c6fcb535fd024933f
parent 332830 598c9eb576abd6da0cb563b8faea329ee3787ee6
child 332832 6983c68ea3d0ba0a202d7da785a4886fa09d5f63
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, ritu
bugs1269365
milestone48.0a2
Bug 1269365 - Part 1 - Swap fallible and infallible TArray ParamTraits. r=froydnj, a=ritu This should not change the behavior, because fallible_t is passed to the array methods. Rename from InfallibleTArray to nsTArray, because that is more usual. Remove unnecessary spaces from some template definitions.
ipc/glue/IPCMessageUtils.h
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -422,19 +422,19 @@ struct ParamTraits<nsLiteralString> : Pa
 };
 
 // Pickle::ReadBytes and ::WriteBytes take the length in ints, so we must
 // ensure there is no overflow. This returns |false| if it would overflow.
 // Otherwise, it returns |true| and places the byte length in |aByteLength|.
 bool ByteLengthIsValid(uint32_t aNumElements, size_t aElementSize, int* aByteLength);
 
 template <typename E>
-struct ParamTraits<FallibleTArray<E> >
+struct ParamTraits<nsTArray<E>>
 {
-  typedef FallibleTArray<E> paramType;
+  typedef nsTArray<E> paramType;
 
   // We write arrays of integer or floating-point data using a single pickling
   // call, rather than writing each element individually.  We deliberately do
   // not use mozilla::IsPod here because it is perfectly reasonable to have
   // a data structure T for which IsPod<T>::value is true, yet also have a
   // ParamTraits<T> specialization.
   static const bool sUseWriteBytes = (mozilla::IsIntegral<E>::value ||
                                       mozilla::IsFloatingPoint<E>::value);
@@ -503,39 +503,39 @@ struct ParamTraits<FallibleTArray<E> >
         aLog->append(L" ");
       }
       LogParam(aParam[index], aLog);
     }
   }
 };
 
 template<typename E>
-struct ParamTraits<InfallibleTArray<E> >
+struct ParamTraits<FallibleTArray<E>>
 {
-  typedef InfallibleTArray<E> paramType;
+  typedef FallibleTArray<E> paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
-    WriteParam(aMsg, static_cast<const FallibleTArray<E>&>(aParam));
+    WriteParam(aMsg, static_cast<const nsTArray<E>&>(aParam));
   }
 
-  // deserialize the array fallibly, but return an InfallibleTArray
+  // Deserialize the array infallibly, but return a FallibleTArray.
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    FallibleTArray<E> temp;
+    nsTArray<E> temp;
     if (!ReadParam(aMsg, aIter, &temp))
       return false;
 
     aResult->SwapElements(temp);
     return true;
   }
 
   static void Log(const paramType& aParam, std::wstring* aLog)
   {
-    LogParam(static_cast<const FallibleTArray<E>&>(aParam), aLog);
+    LogParam(static_cast<const nsTArray<E>&>(aParam), aLog);
   }
 };
 
 template<typename E, size_t N>
 struct ParamTraits<AutoTArray<E, N>> : ParamTraits<nsTArray<E>>
 {
   typedef AutoTArray<E, N> paramType;
 };
@@ -773,17 +773,17 @@ struct ParamTraits<mozilla::SerializedSt
 template <>
 struct ParamTraits<nsIWidget::TouchPointerState>
   : public BitFlagsEnumSerializer<nsIWidget::TouchPointerState,
                                   nsIWidget::TouchPointerState::ALL_BITS>
 {
 };
 
 template<class T>
-struct ParamTraits< mozilla::Maybe<T> >
+struct ParamTraits<mozilla::Maybe<T>>
 {
   typedef mozilla::Maybe<T> paramType;
 
   static void Write(Message* msg, const paramType& param)
   {
     if (param.isSome()) {
       WriteParam(msg, true);
       WriteParam(msg, param.value());