#ifndef INCLUDE_V8_HANDLE_BASE_H_
#define INCLUDE_V8_HANDLE_BASE_H_
#include "v8-internal.h"
namespace v8::api_internal {
template <bool check_statically_enabled>
class StackAllocated { … };
template <>
class V8_TRIVIAL_ABI StackAllocated<true> : public StackAllocated<false> { … };
class IndirectHandleBase { … };
#ifdef V8_ENABLE_DIRECT_HANDLE
class DirectHandleBase {
public:
V8_INLINE bool IsEmpty() const {
return ptr_ == internal::ValueHelper::kEmpty;
}
V8_INLINE void Clear() { ptr_ = internal::ValueHelper::kEmpty; }
protected:
friend class internal::ValueHelper;
friend class internal::HandleHelper;
V8_INLINE DirectHandleBase() = default;
V8_INLINE DirectHandleBase(const DirectHandleBase& other) = default;
V8_INLINE DirectHandleBase& operator=(const DirectHandleBase& that) = default;
V8_INLINE explicit DirectHandleBase(internal::Address ptr) : ptr_(ptr) {}
V8_INLINE internal::Address ptr() const { return ptr_; }
template <typename T, bool check_null = false>
V8_INLINE T* value() const {
return reinterpret_cast<T*>(ptr_);
}
private:
internal::Address ptr_ = internal::ValueHelper::kEmpty;
};
#endif
}
#endif