bug 824970 - wrapper cache and cycle collect nsDOMCSSRect r=bz
authorTrevor Saunders <trev.saunders@gmail.com>
Tue, 25 Dec 2012 21:51:33 -0500
changeset 126317 516b3defe68dc4305f5770bc33f3d5303ca7dc31
parent 126316 0534210e43e588d67b16c97464ac499bf62607b6
child 126318 41f218bd308240098bbfd91205d689b33e6a8b47
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)
reviewersbz
bugs824970
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 824970 - wrapper cache and cycle collect nsDOMCSSRect r=bz
layout/style/nsDOMCSSRect.cpp
layout/style/nsDOMCSSRect.h
--- a/layout/style/nsDOMCSSRect.cpp
+++ b/layout/style/nsDOMCSSRect.cpp
@@ -22,25 +22,27 @@ nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimit
 
 nsDOMCSSRect::~nsDOMCSSRect(void)
 {
 }
 
 DOMCI_DATA(CSSRect, nsDOMCSSRect)
 
 // QueryInterface implementation for nsCSSRect
-NS_INTERFACE_MAP_BEGIN(nsDOMCSSRect)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect)
   NS_INTERFACE_MAP_ENTRY(nsIDOMRect)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSRect)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
 NS_INTERFACE_MAP_END
 
-NS_IMPL_ADDREF(nsDOMCSSRect)
-NS_IMPL_RELEASE(nsDOMCSSRect)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect)
 
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_4(nsDOMCSSRect, mTop, mBottom, mLeft, mRight)
   
 NS_IMETHODIMP
 nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop)
 {
   NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED);
   *aTop = mTop;
   NS_ADDREF(*aTop);
   return NS_OK;
--- a/layout/style/nsDOMCSSRect.h
+++ b/layout/style/nsDOMCSSRect.h
@@ -5,31 +5,37 @@
 
 /* DOM object representing rectangle values in DOM computed style */
 
 #ifndef nsDOMCSSRect_h_
 #define nsDOMCSSRect_h_
 
 #include "nsISupports.h"
 #include "nsIDOMRect.h"
-#include "nsCOMPtr.h"
+#include "nsAutoPtr.h"
+#include "nsCycleCollectionParticipant.h"
+#include "nsWrapperCache.h"
 
 class nsROCSSPrimitiveValue;
 
-class nsDOMCSSRect : public nsIDOMRect {
+class nsDOMCSSRect : public nsIDOMRect,
+                     public nsWrapperCache
+{
 public:
   nsDOMCSSRect(nsROCSSPrimitiveValue* aTop,
                nsROCSSPrimitiveValue* aRight,
                nsROCSSPrimitiveValue* aBottom,
                nsROCSSPrimitiveValue* aLeft);
   virtual ~nsDOMCSSRect(void);
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIDOMRECT
 
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSRect)
+
 private:
   nsRefPtr<nsROCSSPrimitiveValue> mTop;
   nsRefPtr<nsROCSSPrimitiveValue> mRight;
   nsRefPtr<nsROCSSPrimitiveValue> mBottom;
   nsRefPtr<nsROCSSPrimitiveValue> mLeft;
 };
 
 #endif /* nsDOMCSSRect_h_ */