зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824465 - Part 2: NS_INLINE_DECL_REFCOUNTING_INHERITED should always override, r=xpcom-reviewers,emilio,kmag
Without this change, a class with multiple base classes, one of which is concrete, would not implement the pure virtual refcounting methods from the other class. Differential Revision: https://phabricator.services.mozilla.com/D173717
This commit is contained in:
Родитель
68102ede8d
Коммит
ab444bee82
|
@ -1465,28 +1465,20 @@ constexpr bool ShouldLogInheritedRefcnt =
|
|||
NS_IMPL_RELEASE_INHERITED(aClass, aSuper)
|
||||
|
||||
/**
|
||||
* A macro to declare and implement addref/release for a class that does not
|
||||
* need to QI to any interfaces other than the ones its parent class QIs to.
|
||||
* A macro to declare and implement inherited addref/release for a class which
|
||||
* doesn't have or need to override QueryInterface from its base class.
|
||||
*
|
||||
* Note: This macro always overrides the `AddRef` and `Release` methods,
|
||||
* including when refcount logging is disabled, meaning that it will implement
|
||||
* the `AddRef` or `Release` method from another virtual base class.
|
||||
*/
|
||||
#if defined(NS_BUILD_REFCNT_LOGGING)
|
||||
# define NS_INLINE_DECL_REFCOUNTING_INHERITED(Class, Super) \
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef() override { \
|
||||
NS_IMPL_ADDREF_INHERITED_GUTS(Class, Super); \
|
||||
} \
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release() override { \
|
||||
NS_IMPL_RELEASE_INHERITED_GUTS(Class, Super); \
|
||||
}
|
||||
#else // NS_BUILD_REFCNT_LOGGING
|
||||
// Defining inheriting versions of functions in the refcount logging case has
|
||||
// the side effect of making qualified references to |AddRef| and |Release|
|
||||
// on the containing class unambiguous, if |Super| isn't the only base class
|
||||
// that provides these members. So if we're building without refcount
|
||||
// logging, |using| in |Super|'s declarations to make the names similarly
|
||||
// unambiguous.
|
||||
# define NS_INLINE_DECL_REFCOUNTING_INHERITED(Class, Super) \
|
||||
using Super::AddRef; \
|
||||
using Super::Release;
|
||||
#endif // NS_BUILD_REFCNT_LOGGING
|
||||
#define NS_INLINE_DECL_REFCOUNTING_INHERITED(Class, Super) \
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef() override { \
|
||||
NS_IMPL_ADDREF_INHERITED_GUTS(Class, Super); \
|
||||
} \
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release() override { \
|
||||
NS_IMPL_RELEASE_INHERITED_GUTS(Class, Super); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro to glue together a QI that starts with an interface table
|
||||
|
|
Загрузка…
Ссылка в новой задаче