mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1805931, part 1 - Declare Root and Unroot inline to save on boilerplate. r=smaug
Bug 181137 made ContentIteratorBase no longer refcounted, but it did not remove this bit of CC boilerplate. With the inline root, using this macro in a non-refcounted class is an error. ObjectModel.h and ClientWebGLContext.cpp used macros to define root and unroot, but that is no longer needed. Differential Revision: https://phabricator.services.mozilla.com/D164828
This commit is contained in:
parent
bf618bbc4a
commit
dec541b90a
@ -31,8 +31,6 @@ class ContentIteratorBase {
|
||||
ContentIteratorBase& operator=(const ContentIteratorBase&) = delete;
|
||||
virtual ~ContentIteratorBase();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ContentIteratorBase)
|
||||
|
||||
/**
|
||||
* Allows to iterate over the inclusive descendants
|
||||
* (https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant) of
|
||||
|
@ -6765,23 +6765,4 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK_PTR(
|
||||
|
||||
// -----------------------------
|
||||
|
||||
#define _(X) \
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGL##X##JS, AddRef) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGL##X##JS, Release)
|
||||
|
||||
_(Buffer)
|
||||
_(Framebuffer)
|
||||
_(Program)
|
||||
_(Query)
|
||||
_(Renderbuffer)
|
||||
_(Sampler)
|
||||
_(Shader)
|
||||
_(Sync)
|
||||
_(Texture)
|
||||
_(TransformFeedback)
|
||||
_(UniformLocation)
|
||||
_(VertexArray)
|
||||
|
||||
#undef _
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -107,9 +107,7 @@ class ObjectBase : public nsWrapperCache {
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(__VA_ARGS__) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#define GPU_IMPL_CYCLE_COLLECTION(T, ...) \
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(T, AddRef) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(T, Release) \
|
||||
#define GPU_IMPL_CYCLE_COLLECTION(T, ...) \
|
||||
GPU_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(T, __VA_ARGS__)
|
||||
|
||||
template <typename T>
|
||||
|
@ -857,9 +857,13 @@ T* DowncastCCParticipant(void* aPtr) {
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \
|
||||
public: \
|
||||
NS_IMETHOD_(void) Root(void* n) override; \
|
||||
NS_IMETHOD_(void) Root(void* p) override { \
|
||||
static_cast<_class*>(p)->AddRef(); \
|
||||
} \
|
||||
NS_IMETHOD_(void) Unlink(void* n) override; \
|
||||
NS_IMETHOD_(void) Unroot(void* n) override; \
|
||||
NS_IMETHOD_(void) Unroot(void* p) override { \
|
||||
static_cast<_class*>(p)->Release(); \
|
||||
} \
|
||||
NS_IMETHOD TraverseNative(void* n, nsCycleCollectionTraversalCallback& cb) \
|
||||
override; \
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_NAME_METHOD(_class) \
|
||||
@ -940,20 +944,6 @@ T* DowncastCCParticipant(void* aPtr) {
|
||||
}; \
|
||||
static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(_class, _root_function) \
|
||||
NS_IMETHODIMP_(void) \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Root(void* p) { \
|
||||
_class* tmp = static_cast<_class*>(p); \
|
||||
tmp->_root_function(); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(_class, _unroot_function) \
|
||||
NS_IMETHODIMP_(void) \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unroot(void* p) { \
|
||||
_class* tmp = static_cast<_class*>(p); \
|
||||
tmp->_unroot_function(); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
_class::NS_CYCLE_COLLECTION_INNERCLASS _class::NS_CYCLE_COLLECTION_INNERNAME;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user