Bug 856472: CanvasPattern and CanvasGradient don't need to inherit nsISupports r=bz
authorDavid Zbarsky <dzbarsky@gmail.com>
Fri, 26 Jul 2013 11:25:56 -0700
changeset 140201 9bdc850e67f6743cb63d56aa9c775a91dc84235c
parent 140200 889041639eb9248ba0c0402e4f0cbe1c607b33ca
child 140202 97ad9f8fd485505e77d0413a987ab7207d924373
push id1945
push userryanvm@gmail.com
push dateSat, 27 Jul 2013 02:27:26 +0000
treeherderfx-team@4874fa438b1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs856472
milestone25.0a1
Bug 856472: CanvasPattern and CanvasGradient don't need to inherit nsISupports r=bz
content/canvas/src/CanvasGradient.h
content/canvas/src/CanvasPattern.h
content/canvas/src/CanvasRenderingContext2D.cpp
dom/bindings/Bindings.conf
--- a/content/canvas/src/CanvasGradient.h
+++ b/content/canvas/src/CanvasGradient.h
@@ -11,22 +11,21 @@
 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
 #include "mozilla/dom/CanvasRenderingContext2D.h"
 #include "mozilla/gfx/2D.h"
 #include "nsWrapperCache.h"
 
 namespace mozilla {
 namespace dom {
 
-class CanvasGradient : public nsISupports,
-                       public nsWrapperCache
+class CanvasGradient : public nsWrapperCache
 {
 public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasGradient)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasGradient)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasGradient)
 
   enum Type
   {
     LINEAR = 0,
     RADIAL
   };
 
   Type GetType()
--- a/content/canvas/src/CanvasPattern.h
+++ b/content/canvas/src/CanvasPattern.h
@@ -16,22 +16,21 @@ class nsIPrincipal;
 
 namespace mozilla {
 namespace gfx {
 class SourceSurface;
 }
 
 namespace dom {
 
-class CanvasPattern MOZ_FINAL : public nsISupports,
-                                public nsWrapperCache
+class CanvasPattern MOZ_FINAL : public nsWrapperCache
 {
 public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasPattern)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
 
   enum RepeatMode
   {
     REPEAT,
     REPEATX,
     REPEATY,
     NOREPEAT
   };
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -396,36 +396,26 @@ CanvasGradient::AddColorStop(float offse
   GradientStop newStop;
 
   newStop.offset = offset;
   newStop.color = Color::FromABGR(color);
 
   mRawStops.AppendElement(newStop);
 }
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasGradient)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasGradient)
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasGradient, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasGradient, Release)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasGradient, mContext)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasGradient)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasPattern)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasPattern)
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPattern, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPattern, Release)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasPattern, mContext)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasPattern)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
 class CanvasRenderingContext2DUserData : public LayerUserData {
 public:
     CanvasRenderingContext2DUserData(CanvasRenderingContext2D *aContext)
     : mContext(aContext)
   {
     aContext->mUserDatas.AppendElement(this);
   }
   ~CanvasRenderingContext2DUserData()
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -152,16 +152,24 @@ DOMInterfaces = {
     'headerFile': 'BatteryManager.h'
 },
 
 'CameraManager': {
     'nativeType': 'nsDOMCameraManager',
     'headerFile': 'DOMCameraManager.h'
 },
 
+'CanvasGradient' : {
+    'nativeOwnership': 'refcounted'
+},
+
+'CanvasPattern' : {
+    'nativeOwnership': 'refcounted'
+},
+
 'CanvasRenderingContext2D': {
     'implicitJSContext': [
         'createImageData', 'getImageData', 'mozDash'
     ],
     'resultNotAddRefed': [ 'canvas', 'measureText' ],
     'binaryNames': {
         'mozImageSmoothingEnabled': 'imageSmoothingEnabled',
         'mozFillRule': 'fillRule'