Bug 763323 - Use .forget(I**) in a few places; r=longsonr
authorMs2ger <ms2ger@gmail.com>
Wed, 18 Jul 2012 12:36:08 +0200
changeset 99527 dd32a42f5bafd80aa219d3e983f853366e4fc150
parent 99526 1ed8454e709068b33c12a58be93b59d093f7308a
child 99528 1968d3930f17effbdf91c90fef21fd64b11e90ae
push id23139
push userMs2ger@gmail.com
push dateWed, 18 Jul 2012 10:37:46 +0000
treeherdermozilla-central@bf09f11b69d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs763323
milestone17.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 763323 - Use .forget(I**) in a few places; r=longsonr
content/svg/content/src/DOMSVGLengthList.cpp
content/svg/content/src/DOMSVGNumberList.cpp
content/svg/content/src/DOMSVGPathSegList.cpp
content/svg/content/src/DOMSVGPointList.cpp
content/svg/content/src/DOMSVGTransformList.cpp
content/svg/content/src/nsSVGElement.h
--- a/content/svg/content/src/DOMSVGLengthList.cpp
+++ b/content/svg/content/src/DOMSVGLengthList.cpp
@@ -253,17 +253,17 @@ DOMSVGLengthList::InsertItemBefore(nsIDO
   domItem->InsertingIntoList(this, AttrEnum(), index, IsAnimValList());
 
   UpdateListIndicesFromIndex(mItems, index + 1);
 
   Element()->DidChangeLengthList(AttrEnum(), emptyOrOldValue);
   if (mAList->IsAnimating()) {
     Element()->AnimationNeedsResample();
   }
-  *_retval = domItem.forget().get();
+  domItem.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem,
                               PRUint32 index,
                               nsIDOMSVGLength **_retval)
 {
--- a/content/svg/content/src/DOMSVGNumberList.cpp
+++ b/content/svg/content/src/DOMSVGNumberList.cpp
@@ -254,17 +254,17 @@ DOMSVGNumberList::InsertItemBefore(nsIDO
   domItem->InsertingIntoList(this, AttrEnum(), index, IsAnimValList());
 
   UpdateListIndicesFromIndex(mItems, index + 1);
 
   Element()->DidChangeNumberList(AttrEnum(), emptyOrOldValue);
   if (mAList->IsAnimating()) {
     Element()->AnimationNeedsResample();
   }
-  *_retval = domItem.forget().get();
+  domItem.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
                               PRUint32 index,
                               nsIDOMSVGNumber **_retval)
 {
--- a/content/svg/content/src/DOMSVGPathSegList.cpp
+++ b/content/svg/content/src/DOMSVGPathSegList.cpp
@@ -379,17 +379,17 @@ DOMSVGPathSegList::InsertItemBefore(nsID
   domItem->InsertingIntoList(this, aIndex, IsAnimValList());
 
   UpdateListIndicesFromIndex(aIndex + 1, argCount + 1);
 
   Element()->DidChangePathSegList(emptyOrOldValue);
   if (AttrIsAnimating()) {
     Element()->AnimationNeedsResample();
   }
-  *_retval = domItem.forget().get();
+  domItem.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *aNewItem,
                                PRUint32 aIndex,
                                nsIDOMSVGPathSeg **_retval)
 {
--- a/content/svg/content/src/DOMSVGPointList.cpp
+++ b/content/svg/content/src/DOMSVGPointList.cpp
@@ -312,17 +312,17 @@ DOMSVGPointList::InsertItemBefore(nsIDOM
   domItem->InsertingIntoList(this, aIndex, IsAnimValList());
 
   UpdateListIndicesFromIndex(mItems, aIndex + 1);
 
   Element()->DidChangePointList(emptyOrOldValue);
   if (AttrIsAnimating()) {
     Element()->AnimationNeedsResample();
   }
-  *_retval = domItem.forget().get();
+  domItem.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMSVGPointList::ReplaceItem(nsIDOMSVGPoint *aNewItem,
                              PRUint32 aIndex,
                              nsIDOMSVGPoint **_retval)
 {
--- a/content/svg/content/src/DOMSVGTransformList.cpp
+++ b/content/svg/content/src/DOMSVGTransformList.cpp
@@ -268,17 +268,17 @@ DOMSVGTransformList::InsertItemBefore(ns
   domItem->InsertingIntoList(this, index, IsAnimValList());
 
   UpdateListIndicesFromIndex(mItems, index + 1);
 
   Element()->DidChangeTransformList(emptyOrOldValue);
   if (mAList->IsAnimating()) {
     Element()->AnimationNeedsResample();
   }
-  *_retval = domItem.forget().get();
+  domItem.forget(_retval);
   return NS_OK;
 }
 
 /* nsIDOMSVGTransform replaceItem (in nsIDOMSVGTransform newItem,
  *                                 in unsigned long index); */
 NS_IMETHODIMP
 DOMSVGTransformList::ReplaceItem(nsIDOMSVGTransform *newItem,
                                  PRUint32 index,
--- a/content/svg/content/src/nsSVGElement.h
+++ b/content/svg/content/src/nsSVGElement.h
@@ -583,48 +583,44 @@ private:
  */
 #define NS_IMPL_NS_NEW_SVG_ELEMENT(_elementName)                             \
 nsresult                                                                     \
 NS_NewSVG##_elementName##Element(nsIContent **aResult,                       \
                                  already_AddRefed<nsINodeInfo> aNodeInfo)    \
 {                                                                            \
   nsRefPtr<nsSVG##_elementName##Element> it =                                \
     new nsSVG##_elementName##Element(aNodeInfo);                             \
-  if (!it)                                                                   \
-    return NS_ERROR_OUT_OF_MEMORY;                                           \
                                                                              \
   nsresult rv = it->Init();                                                  \
                                                                              \
   if (NS_FAILED(rv)) {                                                       \
     return rv;                                                               \
   }                                                                          \
                                                                              \
-  *aResult = it.forget().get();                                              \
+  it.forget(aResult);                                                        \
                                                                              \
   return rv;                                                                 \
 }
 
 #define NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(_elementName)                \
 nsresult                                                                     \
 NS_NewSVG##_elementName##Element(nsIContent **aResult,                       \
                                  already_AddRefed<nsINodeInfo> aNodeInfo,    \
                                  FromParser aFromParser)                     \
 {                                                                            \
   nsRefPtr<nsSVG##_elementName##Element> it =                                \
     new nsSVG##_elementName##Element(aNodeInfo, aFromParser);                \
-  if (!it)                                                                   \
-    return NS_ERROR_OUT_OF_MEMORY;                                           \
                                                                              \
   nsresult rv = it->Init();                                                  \
                                                                              \
   if (NS_FAILED(rv)) {                                                       \
     return rv;                                                               \
   }                                                                          \
                                                                              \
-  *aResult = it.forget().get();                                              \
+  it.forget(aResult);                                                        \
                                                                              \
   return rv;                                                                 \
 }
 
  // No unlinking, we'd need to null out the value pointer (the object it
 // points to is held by the element) and null-check it everywhere.
 #define NS_SVG_VAL_IMPL_CYCLE_COLLECTION(_val, _element)                     \
 NS_IMPL_CYCLE_COLLECTION_CLASS(_val)                                         \