nsCSSShadowArray-refcounting
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 157 8daebed024b6410329793f900335824e1f0b77b6
permissions -rw-r--r--
State as of now

diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1559,15 +1559,12 @@ nsChangeHint nsStyleTextReset::MaxDiffer
 // nsCSSShadowItem
 //
 
-nsrefcnt
-nsCSSShadowArray::Release()
+void
+nsCSSShadowArray::ReleaseReference()
 {
-  mRefCnt--;
-  if (mRefCnt == 0) {
+  if (--mRefCnt == 0) {
     delete this;
-    return 0;
   }
-  return mRefCnt;
 }
 
 static nsChangeHint
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -61,6 +61,7 @@
 #include "nsIAtom.h"
 #include "nsIURI.h"
 #include "nsCSSValue.h"
+#include "mozilla/RefPtr.h"
 
 class nsIFrame;
 class imgIRequest;
@@ -364,8 +365,8 @@ class nsCSSShadowArray {
       }
     }
 
-    nsrefcnt AddRef() { return ++mRefCnt; }
-    nsrefcnt Release();
+    void AddReference() { ++mRefCnt; }
+    void ReleaseReference();
 
     PRUint32 Length() const { return mLength; }
     nsCSSShadowItem* ShadowAt(PRUint32 i) {
@@ -418,7 +419,7 @@ struct nsStyleBorder {
   nsStyleSides  mBorderRadius;    // [reset] length, percent
   PRUint8       mFloatEdge;       // [reset] see nsStyleConsts.h
   nsBorderColors** mBorderColors; // [reset] multiple levels of color for a border.
-  nsRefPtr<nsCSSShadowArray> mBoxShadow; // [reset] NULL for 'none'
+  mozilla::RefPtr<nsCSSShadowArray> mBoxShadow; // [reset] NULL for 'none'
 
   void EnsureBorderColors() {
     if (!mBorderColors) {
@@ -774,7 +775,7 @@ struct nsStyleText {
   nsStyleCoord  mTextIndent;            // [inherited] 
   nsStyleCoord  mWordSpacing;           // [inherited] 
 
-  nsRefPtr<nsCSSShadowArray> mTextShadow; // [inherited] NULL in case of a zero-length
+  mozilla::RefPtr<nsCSSShadowArray> mTextShadow; // [inherited] NULL in case of a zero-length
   
   PRBool WhiteSpaceIsSignificant() const {
     return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||