v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
trace-trait.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_CPPGC_TRACE_TRAIT_H_
6#define INCLUDE_CPPGC_TRACE_TRAIT_H_
7
8#include <type_traits>
9
10#include "cppgc/type-traits.h"
11#include "v8config.h" // NOLINT(build/include_directory)
12
13namespace cppgc {
14
15class Visitor;
16
17namespace internal {
18
19// Implementation of the default TraceTrait handling GarbageCollected and
20// GarbageCollectedMixin.
21template <typename T,
22 bool =
23 IsGarbageCollectedMixinTypeV<typename std::remove_const<T>::type>>
25
26} // namespace internal
27
34using TraceCallback = void (*)(Visitor* visitor, const void* object);
35
50};
51
52namespace internal {
53
55 static TraceDescriptor GetTraceDescriptor(const void* address);
56};
57
64template <typename T>
66 static_assert(internal::IsTraceableV<T>, "T must have a Trace() method");
67
74 static TraceDescriptor GetTraceDescriptor(const void* self) {
76 static_cast<const T*>(self));
77 }
78
85 static void Trace(Visitor* visitor, const void* self) {
86 static_cast<const T*>(self)->Trace(visitor);
87 }
88};
89
90} // namespace internal
91
92template <typename T>
94
95namespace internal {
96
97template <typename T>
99 static_assert(IsGarbageCollectedTypeV<T>,
100 "T must be of type GarbageCollected or GarbageCollectedMixin");
101 static TraceDescriptor GetTraceDescriptor(const void* self) {
102 return {self, TraceTrait<T>::Trace};
103 }
104};
105
106template <typename T>
108 static TraceDescriptor GetTraceDescriptor(const void* self) {
110 }
111};
112
113} // namespace internal
114} // namespace cppgc
115
116#endif // INCLUDE_CPPGC_TRACE_TRAIT_H_
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition trace-trait.h:34
TraceCallback callback
Definition trace-trait.h:49
const void * base_object_payload
Definition trace-trait.h:45
static void Trace(Visitor *visitor, const void *self)
Definition trace-trait.h:85
static TraceDescriptor GetTraceDescriptor(const void *self)
Definition trace-trait.h:74
static TraceDescriptor GetTraceDescriptor(const void *address)
static TraceDescriptor GetTraceDescriptor(const void *self)
static TraceDescriptor GetTraceDescriptor(const void *self)
#define V8_EXPORT
Definition v8config.h:578