Bug 968520 - Add mozilla::fallible to more FallibleTArray::InsertElementsAt calls. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 09 Jun 2015 17:27:35 -0700
changeset 280188 87b7bc3f561adf3cf66fa3d293507abad3666f7b
parent 280187 31e36b1649741834a9775b8e2fca02164f002145
child 280189 632d018e4f261e155b9aeae006095c8c64aa9c4b
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs968520
milestone41.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 968520 - Add mozilla::fallible to more FallibleTArray::InsertElementsAt calls. r=froydnj
dom/media/MediaData.cpp
dom/network/TCPSocketChild.cpp
dom/network/TCPSocketParent.cpp
dom/network/UDPSocketChild.cpp
dom/network/UDPSocketParent.cpp
dom/svg/DOMSVGPathSegList.cpp
netwerk/base/nsUDPSocket.cpp
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -634,17 +634,18 @@ MediaRawDataWriter::SetSize(size_t aSize
 bool
 MediaRawDataWriter::Prepend(const uint8_t* aData, size_t aSize)
 {
   if (!EnsureSize(aSize + mTarget->mSize)) {
     return false;
   }
 
   // We ensure sufficient capacity above so this shouldn't fail.
-  MOZ_ALWAYS_TRUE(mBuffer->InsertElementsAt(mTarget->mPadding, aData, aSize));
+  MOZ_ALWAYS_TRUE(mBuffer->InsertElementsAt(mTarget->mPadding, aData, aSize,
+                                            fallible));
   mTarget->mSize += aSize;
   mSize = mTarget->mSize;
   return true;
 }
 
 bool
 MediaRawDataWriter::Replace(const uint8_t* aData, size_t aSize)
 {
--- a/dom/network/TCPSocketChild.cpp
+++ b/dom/network/TCPSocketChild.cpp
@@ -232,17 +232,18 @@ TCPSocketChild::SendSend(JS::Handle<JS::
     uint32_t nbytes = std::min(buflen - aByteOffset, aByteLength);
     FallibleTArray<uint8_t> fallibleArr;
     {
         JS::AutoCheckCannotGC nogc;
         uint8_t* data = JS_GetArrayBufferData(obj, nogc);
         if (!data) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
-        if (!fallibleArr.InsertElementsAt(0, data + aByteOffset, nbytes)) {
+        if (!fallibleArr.InsertElementsAt(0, data + aByteOffset, nbytes,
+                                          fallible)) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
     }
     InfallibleTArray<uint8_t> arr;
     arr.SwapElements(fallibleArr);
     SendData(arr, aTrackingNumber);
   }
   return NS_OK;
--- a/dom/network/TCPSocketParent.cpp
+++ b/dom/network/TCPSocketParent.cpp
@@ -306,17 +306,17 @@ TCPSocketParent::SendEvent(const nsAStri
       do {
           JS::AutoCheckCannotGC nogc;
           uint32_t nbytes = JS_GetArrayBufferByteLength(obj);
           uint8_t* buffer = JS_GetArrayBufferData(obj, nogc);
           if (!buffer) {
               errLine = __LINE__;
               break;
           }
-          if (!fallibleArr.InsertElementsAt(0, buffer, nbytes)) {
+          if (!fallibleArr.InsertElementsAt(0, buffer, nbytes, fallible)) {
               errLine = __LINE__;
               break;
           }
       } while (false);
 
       if (errLine) {
           FireInteralError(this, errLine);
           return NS_ERROR_OUT_OF_MEMORY;
--- a/dom/network/UDPSocketChild.cpp
+++ b/dom/network/UDPSocketChild.cpp
@@ -244,17 +244,17 @@ UDPSocketChild::SendWithAddress(const Ne
 nsresult
 UDPSocketChild::SendDataInternal(const UDPSocketAddr& aAddr,
                                  const uint8_t* aData,
                                  const uint32_t aByteLength)
 {
   NS_ENSURE_ARG(aData);
 
   FallibleTArray<uint8_t> fallibleArray;
-  if (!fallibleArray.InsertElementsAt(0, aData, aByteLength)) {
+  if (!fallibleArray.InsertElementsAt(0, aData, aByteLength, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   InfallibleTArray<uint8_t> array;
   array.SwapElements(fallibleArray);
 
   SendOutgoingData(array, aAddr);
 
--- a/dom/network/UDPSocketParent.cpp
+++ b/dom/network/UDPSocketParent.cpp
@@ -446,17 +446,17 @@ UDPSocketParent::OnPacketReceived(nsIUDP
       if (!allowed) {
         UDPSOCKET_LOG(("%s: not allowed", __FUNCTION__));
       }
       return NS_OK;
     }
   }
 
   FallibleTArray<uint8_t> fallibleArray;
-  if (!fallibleArray.InsertElementsAt(0, buffer, len)) {
+  if (!fallibleArray.InsertElementsAt(0, buffer, len, fallible)) {
     FireInternalError(__LINE__);
     return NS_ERROR_OUT_OF_MEMORY;
   }
   InfallibleTArray<uint8_t> infallibleArray;
   infallibleArray.SwapElements(fallibleArray);
 
   // compose callback
   mozilla::unused << SendCallbackReceivedData(UDPAddressInfo(ip, port), infallibleArray);
--- a/dom/svg/DOMSVGPathSegList.cpp
+++ b/dom/svg/DOMSVGPathSegList.cpp
@@ -380,17 +380,18 @@ DOMSVGPathSegList::InsertItemBefore(DOMS
   // Now that we know we're inserting, keep animVal list in sync as necessary.
   MaybeInsertNullInAnimValListAt(aIndex, internalIndex, argCount);
 
   float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
   domItem->ToSVGPathSegEncodedData(segAsRaw);
 
   MOZ_ALWAYS_TRUE(InternalList().mData.InsertElementsAt(internalIndex,
                                                         segAsRaw,
-                                                        1 + argCount));
+                                                        1 + argCount,
+                                                        fallible));
   MOZ_ALWAYS_TRUE(mItems.InsertElementAt(aIndex,
                                          ItemProxy(domItem.get(),
                                                    internalIndex),
                                          fallible));
 
   // This MUST come after the insertion into InternalList(), or else under the
   // insertion into InternalList() the values read from domItem would be bad
   // data from InternalList() itself!:
--- a/netwerk/base/nsUDPSocket.cpp
+++ b/netwerk/base/nsUDPSocket.cpp
@@ -1306,17 +1306,17 @@ nsUDPSocket::Send(const nsACString &aHos
                   uint32_t *_retval)
 {
   NS_ENSURE_ARG(aData);
   NS_ENSURE_ARG_POINTER(_retval);
 
   *_retval = 0;
 
   FallibleTArray<uint8_t> fallibleArray;
-  if (!fallibleArray.InsertElementsAt(0, aData, aDataLength)) {
+  if (!fallibleArray.InsertElementsAt(0, aData, aDataLength, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   nsCOMPtr<nsIDNSListener> listener = new PendingSend(this, aPort, fallibleArray);
 
   nsresult rv = ResolveHost(aHost, listener);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1364,17 +1364,17 @@ nsUDPSocket::SendWithAddress(const NetAd
     if (count < 0) {
       PRErrorCode code = PR_GetError();
       return ErrorAccordingToNSPR(code);
     }
     this->AddOutputBytes(count);
     *_retval = count;
   } else {
     FallibleTArray<uint8_t> fallibleArray;
-    if (!fallibleArray.InsertElementsAt(0, aData, aDataLength)) {
+    if (!fallibleArray.InsertElementsAt(0, aData, aDataLength, fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     nsresult rv = mSts->Dispatch(new SendRequestRunnable(this, *aAddr, fallibleArray),
                                  NS_DISPATCH_NORMAL);
     NS_ENSURE_SUCCESS(rv, rv);
     *_retval = aDataLength;
   }