mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1056356 - Remove the hand-rolled mechanism used to get nsRefPtr<const OverscrollHandoffChaiin> to work. r=kats
--HG-- extra : rebase_source : b064c9389e596a0953aa59e92fc842f8fc561ef2
This commit is contained in:
parent
a7263cd695
commit
199b95a880
@ -19,39 +19,6 @@ 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
|
||||
@ -70,7 +37,7 @@ public:
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user