Bug 819791 - Part 2: Don't use nsTArray allocators in IPCMessageUtils traits. r=cjones
authorJustin Lebar <justin.lebar@gmail.com>
Tue, 18 Dec 2012 20:16:06 -0500
changeset 125580 28b5c8d25fb9
parent 125579 24e3a92d51d4
child 125581 1a0cd3aa1864
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs819791
milestone20.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 819791 - Part 2: Don't use nsTArray allocators in IPCMessageUtils traits. r=cjones The allocators will be restricted to non-public use in a later patch.
ipc/glue/IPCMessageUtils.h
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -331,20 +331,20 @@ struct ParamTraits<nsAutoCString> : Para
 #endif  // MOZILLA_INTERNAL_API
 
 template <>
 struct ParamTraits<nsString> : ParamTraits<nsAString>
 {
   typedef nsString paramType;
 };
 
-template <typename E, class A>
-struct ParamTraits<nsTArray<E, A> >
+template <typename E>
+struct ParamTraits<FallibleTArray<E> >
 {
-  typedef nsTArray<E, A> paramType;
+  typedef FallibleTArray<E> paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     uint32_t length = aParam.Length();
     WriteParam(aMsg, length);
     for (uint32_t index = 0; index < length; index++) {
       WriteParam(aMsg, aParam[index]);
     }
@@ -375,35 +375,40 @@ struct ParamTraits<nsTArray<E, A> >
         aLog->append(L" ");
       }
       LogParam(aParam[index], aLog);
     }
   }
 };
 
 template<typename E>
-struct ParamTraits<InfallibleTArray<E> > :
-  ParamTraits<nsTArray<E, nsTArrayInfallibleAllocator> >
+struct ParamTraits<InfallibleTArray<E> >
 {
   typedef InfallibleTArray<E> paramType;
 
-  // use nsTArray Write() method
+  static void Write(Message* aMsg, const paramType& aParam)
+  {
+    WriteParam(aMsg, static_cast<const FallibleTArray<E>&>(aParam));
+  }
 
   // deserialize the array fallibly, but return an InfallibleTArray
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     FallibleTArray<E> temp;
     if (!ReadParam(aMsg, aIter, &temp))
       return false;
 
     aResult->SwapElements(temp);
     return true;
   }
 
-  // use nsTArray Log() method
+  static void Log(const paramType& aParam, std::wstring* aLog)
+  {
+    LogParam(static_cast<const FallibleTArray<E>&>(aParam), aLog);
+  }
 };
 
 template<>
 struct ParamTraits<float>
 {
   typedef float paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)