5 #ifndef INCLUDE_V8_CPPGC_H_
6 #define INCLUDE_V8_CPPGC_H_
8 #include "cppgc/visitor.h"
20 class JSMemberBaseExtractor;
28 bool IsEmpty()
const {
return val_ ==
nullptr; }
44 JSMemberBase() =
default;
47 : val_(New(isolate, object_slot, &val_)) {}
64 Copy(&other.val_, &val_);
74 Move(&other.val_, &val_);
94 static_assert(std::is_base_of<
v8::
Value, T>::value,
95 "JSMember only supports references to v8::Value");
100 template <
typename U,
101 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
108 template <
typename U,
109 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
116 template <
typename U,
117 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
119 MoveImpl(std::move(other));
124 template <
typename U,
125 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
127 return CopyImpl(other);
132 template <
typename U,
133 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
135 return MoveImpl(other);
138 T*
operator->()
const {
return reinterpret_cast<T*>(val_); }
139 T*
operator*()
const {
return reinterpret_cast<T*>(val_); }
143 template <
typename U,
144 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
147 val_ = New(isolate,
reinterpret_cast<
internal::
Address*>(*that), &val_);
151 template <
typename T1,
typename T2,
152 typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
153 std::is_base_of<T1, T2>::value>>
157 if (a ==
nullptr)
return b ==
nullptr;
158 if (b ==
nullptr)
return false;
162 template <
typename T1,
typename T2,
163 typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
164 std::is_base_of<T1, T2>::value>>
166 return !(lhs == rhs);
169 template <
typename T1,
typename T2,
170 typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
171 std::is_base_of<T1, T2>::value>>
175 if (a ==
nullptr)
return b ==
nullptr;
176 if (b ==
nullptr)
return false;
180 template <
typename T1,
typename T2,
181 typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
182 std::is_base_of<T1, T2>::value>>
187 template <
typename T1,
typename T2>
189 return !(lhs == rhs);
192 template <
typename T1,
typename T2>
194 return !(lhs == rhs);
201 template <
typename T>
203 if (ref.IsEmpty())
return;
217 template <
typename T>
220 static_cast<
v8::
JSVisitor*>(visitor)->Trace(*self);