Bug 793554: Devirtualize mozilla::css::Loader::[AddRef|Release] r=dbaron
authorKyle Huey <khuey@kylehuey.com>
Mon, 24 Sep 2012 07:29:24 -0700
changeset 107972 e327e66a027dde88be68f59a40a93d653f870acb
parent 107971 faa753e8601f859015e3cd2db038edfcc90a07f5
child 107973 4a9d494f4376baf835afef9053bf367a9f4bbfc3
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersdbaron
bugs793554
milestone18.0a1
Bug 793554: Devirtualize mozilla::css::Loader::[AddRef|Release] r=dbaron
layout/style/Loader.cpp
layout/style/Loader.h
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -532,19 +532,16 @@ Loader::~Loader()
                "How did we get destroyed when there are loading data?");
   NS_ASSERTION((!mPendingDatas.IsInitialized()) || mPendingDatas.Count() == 0,
                "How did we get destroyed when there are pending data?");
   // Note: no real need to revoke our stylesheet loaded events -- they
   // hold strong references to us, so if we're going away that means
   // they're all done.
 }
 
-NS_IMPL_ADDREF(Loader)
-NS_IMPL_RELEASE(Loader)
-
 void
 Loader::DropDocumentReference(void)
 {
   mDocument = nullptr;
   // Flush out pending datas just so we don't leak by accident.  These
   // loads should short-circuit through the mDocument check in
   // LoadSheet and just end up in SheetComplete immediately
   if (mPendingDatas.IsInitialized()) {
--- a/layout/style/Loader.h
+++ b/layout/style/Loader.h
@@ -118,19 +118,17 @@ enum StyleSheetState {
 };
 
 class Loader MOZ_FINAL {
 public:
   Loader();
   Loader(nsIDocument*);
   ~Loader();
 
-  // This isn't a COM class but it's reference-counted like one.
-  NS_IMETHOD_(nsrefcnt) AddRef();
-  NS_IMETHOD_(nsrefcnt) Release();
+  NS_INLINE_DECL_REFCOUNTING(Loader)
 
   void DropDocumentReference(); // notification that doc is going away
 
   void SetCompatibilityMode(nsCompatibility aCompatMode)
   { mCompatMode = aCompatMode; }
   nsCompatibility GetCompatibilityMode() { return mCompatMode; }
   nsresult SetPreferredSheet(const nsAString& aTitle);
 
@@ -462,19 +460,16 @@ private:
 
   // Our array of "global" observers
   // XXXbz these are strong refs; should we be cycle collecting CSS loaders?
   nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver> > mObservers;
 
   // the load data needs access to the document...
   nsIDocument*      mDocument;  // the document we live for
 
-  // Refcounting
-  nsAutoRefCnt      mRefCnt;
-  NS_DECL_OWNINGTHREAD
 
   // Number of datas still waiting to be notified on if we're notifying on a
   // whole bunch at once (e.g. in one of the stop methods).  This is used to
   // make sure that HasPendingLoads() won't return false until we're notifying
   // on the last data we're working with.
   uint32_t          mDatasToNotifyOn;
 
   nsCompatibility   mCompatMode;