Bug 831673, r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Sat, 19 Jan 2013 15:56:31 -0500
changeset 119371 abafe7350c6f1a95a7811b17ec23f6440be0a7ac
parent 119370 e5321a44b63c1e0cb89dd86de23a2837eddc3fcd
child 119372 f849e0aa18d6999c7a2e5bdf609b9eb27cf00f89
push id24197
push userryanvm@gmail.com
push dateSun, 20 Jan 2013 05:25:28 +0000
treeherdermozilla-central@1d122eaa9070 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs831673
milestone21.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 831673, r=bz
content/svg/content/src/DOMSVGTransform.cpp
content/svg/content/src/DOMSVGTransform.h
dom/bindings/Bindings.conf
--- a/content/svg/content/src/DOMSVGTransform.cpp
+++ b/content/svg/content/src/DOMSVGTransform.cpp
@@ -33,16 +33,19 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DO
     tmp->mList->mItems[tmp->mListIndex] = nullptr;
   }
 NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGTransform)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
+  SVGMatrix* matrix =
+    sSVGMatrixTearoffTable.GetTearoff(tmp);
+  CycleCollectionNoteChild(cb, matrix, "matrix");
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGTransform)
 NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGTransform)
@@ -106,41 +109,45 @@ DOMSVGTransform::DOMSVGTransform(const S
   , mIsAnimValItem(false)
   , mTransform(new SVGTransform(aTransform))
 {
   SetIsDOMBinding();
 }
 
 DOMSVGTransform::~DOMSVGTransform()
 {
-  sSVGMatrixTearoffTable.RemoveTearoff(this);
+  SVGMatrix* matrix = sSVGMatrixTearoffTable.GetTearoff(this);
+  if (matrix) {
+    sSVGMatrixTearoffTable.RemoveTearoff(this);
+    NS_RELEASE(matrix);
+  }
   // Our mList's weak ref to us must be nulled out when we die. If GC has
   // unlinked us using the cycle collector code, then that has already
   // happened, and mList is null.
   if (mList) {
     mList->mItems[mListIndex] = nullptr;
   }
 }
 
 uint16_t
 DOMSVGTransform::Type() const
 {
   return Transform().Type();
 }
 
-already_AddRefed<SVGMatrix>
+SVGMatrix*
 DOMSVGTransform::Matrix()
 {
-  nsRefPtr<SVGMatrix> wrapper =
+  SVGMatrix* wrapper =
     sSVGMatrixTearoffTable.GetTearoff(this);
   if (!wrapper) {
-    wrapper = new SVGMatrix(*this);
+    NS_ADDREF(wrapper = new SVGMatrix(*this));
     sSVGMatrixTearoffTable.AddTearoff(this, wrapper);
   }
-  return wrapper.forget();
+  return wrapper;
 }
 
 float
 DOMSVGTransform::Angle() const
 {
   return Transform().Angle();
 }
 
--- a/content/svg/content/src/DOMSVGTransform.h
+++ b/content/svg/content/src/DOMSVGTransform.h
@@ -128,17 +128,17 @@ public:
   SVGTransform ToSVGTransform() const {
     return Transform();
   }
 
   // WebIDL
   DOMSVGTransformList* GetParentObject() const { return mList; }
   virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap);
   uint16_t Type() const;
-  already_AddRefed<dom::SVGMatrix> Matrix();
+  dom::SVGMatrix* Matrix();
   float Angle() const;
   void SetMatrix(dom::SVGMatrix& matrix, ErrorResult& rv);
   void SetTranslate(float tx, float ty, ErrorResult& rv);
   void SetScale(float sx, float sy, ErrorResult& rv);
   void SetRotate(float angle, float cx, float cy, ErrorResult& rv);
   void SetSkewX(float angle, ErrorResult& rv);
   void SetSkewY(float angle, ErrorResult& rv);
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -795,17 +795,18 @@ DOMInterfaces = {
 },
 
 'SVGTitleElement': {
   'hasInstanceInterface': 'nsIDOMSVGTitleElement',
 },
 
 'SVGTransform': {
     'nativeType': 'mozilla::DOMSVGTransform',
-    'headerFile': 'DOMSVGTransform.h'
+    'headerFile': 'DOMSVGTransform.h',
+    'resultNotAddRefed': [ 'matrix' ]
 },
 
 'SVGTransformableElement': {
     'concrete': False
 },
 
 'SVGTransformList': {
     'nativeType': 'mozilla::DOMSVGTransformList',