22 #ifndef SRC_NODE_OBJECT_WRAP_H_ 23 #define SRC_NODE_OBJECT_WRAP_H_ 49 assert(!handle.IsEmpty());
50 assert(handle->InternalFieldCount() > 0);
53 void* ptr = handle->GetAlignedPointerFromInternalField(0);
55 return static_cast<T*
>(
wrap);
59 inline v8::Local<v8::Object>
handle() {
60 return handle(v8::Isolate::GetCurrent());
64 inline v8::Local<v8::Object>
handle(v8::Isolate* isolate) {
77 assert(handle->InternalFieldCount() > 0);
78 handle->SetAlignedPointerInInternalField(0,
this);
79 persistent().Reset(v8::Isolate::GetCurrent(), handle);
85 persistent().SetWeak(
this, WeakCallback, v8::WeakCallbackType::kParameter);
119 static void WeakCallback(
120 const v8::WeakCallbackInfo<ObjectWrap>&
data) {
122 assert(wrap->
refs_ == 0);
123 wrap->handle_.Reset();
127 v8::Persistent<v8::Object> handle_;
132 #endif // SRC_NODE_OBJECT_WRAP_H_ static T * Unwrap(v8::Local< v8::Object > handle)
void Wrap(v8::Local< v8::Object > handle)
union node::cares_wrap::@8::CaresAsyncData::@0 data
v8::Local< v8::Object > handle(v8::Isolate *isolate)
MaybeLocal< Object > New(Isolate *isolate, Local< String > string, enum encoding enc)
v8::Local< v8::Object > handle()
v8::Persistent< v8::Object > & persistent()