Bug 1056356 - Remove the hand-rolled mechanism used to get nsRefPtr<const OverscrollHandoffChaiin> to work. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 29 Jul 2015 19:52:42 -0400
changeset 256342 27d20d1b6f9a
parent 256341 d22e3da3ebcf
child 256343 25d448978f89
push id63307
push userbballo@mozilla.com
push date2015-08-05 18:03 +0000
treeherdermozilla-inbound@27d20d1b6f9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1056356
milestone42.0a1
Bug 1056356 - Remove the hand-rolled mechanism used to get nsRefPtr<const OverscrollHandoffChaiin> to work. r=kats
gfx/layers/apz/src/OverscrollHandoffState.h
--- a/gfx/layers/apz/src/OverscrollHandoffState.h
+++ b/gfx/layers/apz/src/OverscrollHandoffState.h
@@ -15,49 +15,16 @@
 #include "Units.h"            // for ScreenPoint
 
 namespace mozilla {
 namespace layers {
 
 class AsyncPanZoomController;
 
 /**
- * A variant of NS_INLINE_DECL_THREADSAFE_REFCOUNTING which makes the refcount
- * variable |mutable|, and the AddRef and Release methods |const|, to allow
- * using an |nsRefPtr<const T>|, and thereby enforcing better const-correctness.
- * This is currently here because OverscrollHandoffChain is the only thing
- * currently using it. As a follow-up, we can move this to xpcom/glue, write
- * a corresponding version for non-threadsafe refcounting, and perhaps
- * transition other clients of NS_INLINE_DECL_[THREADSAFE_]REFCOUNTING to the
- * mutable versions.
- */
-#define NS_INLINE_DECL_THREADSAFE_MUTABLE_REFCOUNTING(_class)                 \
-public:                                                                       \
-  NS_METHOD_(MozExternalRefCountType) AddRef(void) const {                    \
-    MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(_class)                                \
-    MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");                      \
-    nsrefcnt count = ++mRefCnt;                                               \
-    NS_LOG_ADDREF(const_cast<_class*>(this), count, #_class, sizeof(*this));  \
-    return (nsrefcnt) count;                                                  \
-  }                                                                           \
-  NS_METHOD_(MozExternalRefCountType) Release(void) const {                   \
-    MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release");                          \
-    nsrefcnt count = --mRefCnt;                                               \
-    NS_LOG_RELEASE(const_cast<_class*>(this), count, #_class);                \
-    if (count == 0) {                                                         \
-      delete (this);                                                          \
-      return 0;                                                               \
-    }                                                                         \
-    return count;                                                             \
-  }                                                                           \
-protected:                                                                    \
-  mutable ::mozilla::ThreadSafeAutoRefCnt mRefCnt;                            \
-public:
-
-/**
  * This class represents the chain of APZCs along which overscroll is handed off.
  * It is created by APZCTreeManager by starting from an initial APZC which is
  * the target for input events, and following the scroll parent ID links (often
  * but not always corresponding to parent pointers in the APZC tree), then
  * adjusting for scrollgrab.
  */
 class OverscrollHandoffChain
 {
@@ -65,17 +32,17 @@ protected:
   // Reference-counted classes cannot have public destructors.
   ~OverscrollHandoffChain();
 public:
   // Threadsafe so that the controller and compositor threads can both maintain
   // nsRefPtrs to the same handoff chain.
   // Mutable so that we can pass around the class by
   // nsRefPtr<const OverscrollHandoffChain> and thus enforce that, once built,
   // the chain is not modified.
-  NS_INLINE_DECL_THREADSAFE_MUTABLE_REFCOUNTING(OverscrollHandoffChain)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OverscrollHandoffChain)
 
   /*
    * Methods for building the handoff chain.
    * These should be used only by AsyncPanZoomController::BuildOverscrollHandoffChain().
    */
   void Add(AsyncPanZoomController* aApzc);
   void SortByScrollPriority();