v8  8.4.371 (node 14.15.5)
V8 is Google's open source JavaScript engine
garbage-collected.h File Reference
#include <type_traits>
#include "cppgc/internal/api-constants.h"
#include "cppgc/macros.h"
#include "cppgc/platform.h"
#include "cppgc/trace-trait.h"
#include "cppgc/type-traits.h"
Include dependency graph for garbage-collected.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  GarbageCollectedBase
 
class  GarbageCollected< typename >
 
class  GarbageCollectedMixin
 

Namespaces

 cppgc
 
 cppgc::internal
 

Macros

#define USING_GARBAGE_COLLECTED_MIXIN()
 
#define MERGE_GARBAGE_COLLECTED_MIXINS()
 

Macro Definition Documentation

◆ MERGE_GARBAGE_COLLECTED_MIXINS

#define MERGE_GARBAGE_COLLECTED_MIXINS ( )
Value:
public: \
/* When using multiple mixins the methods become */ \
/* ambigous. Providing additional implementations */ \
/* disambiguate them again. */ \
TraceDescriptor GetTraceDescriptor() const override { \
return {kNotFullyConstructedObject, nullptr}; \
} \
\
private: \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro

Merge two or more Mixins into one.

class A : public GarbageCollectedMixin {};
class B : public GarbageCollectedMixin {};
class C : public A, public B {
public:
};
#define MERGE_GARBAGE_COLLECTED_MIXINS()

Definition at line 178 of file garbage-collected.h.

◆ USING_GARBAGE_COLLECTED_MIXIN

#define USING_GARBAGE_COLLECTED_MIXIN ( )
Value:
public: \
/* Marker is used by clang to check for proper usages of the macro. */ \
typedef int HasUsingGarbageCollectedMixinMacro; \
\
TraceDescriptor GetTraceDescriptor() const override { \
static_assert( \
internal::IsSubclassOfTemplate< \
std::remove_const_t<std::remove_pointer_t<decltype(this)>>, \
"Only garbage collected objects can have garbage collected mixins"); \
return {this, TraceTrait<std::remove_const_t< \
std::remove_pointer_t<decltype(this)>>>::Trace}; \
} \
\
private: \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro

Macro defines all methods and markers needed for handling mixins. Must be used on the type that is inheriting from GarbageCollected and GarbageCollectedMixin.

class Mixin : public GarbageCollectedMixin {
public:
void Trace(cppgc::Visitor* visitor) const override {
// Dispatch using visitor->Trace(...);
}
};
class Foo : public GarbageCollected<Foo>, public Mixin {
public:
void Trace(cppgc::Visitor* visitor) const override {
// Dispatch using visitor->Trace(...);
Mixin::Trace(visitor);
}
};
#define USING_GARBAGE_COLLECTED_MIXIN()

Definition at line 148 of file garbage-collected.h.