src: add ClearWrap() to util.h
Counterpart to Wrap(), clears the previously assigned internal field. Will be used in an upcoming commit. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
de9a444ab4
commit
1e99486cc8
@ -107,6 +107,10 @@ void Wrap(v8::Local<v8::Object> object, TypeName* pointer) {
|
||||
object->SetAlignedPointerInInternalField(0, pointer);
|
||||
}
|
||||
|
||||
void ClearWrap(v8::Local<v8::Object> object) {
|
||||
Wrap<void>(object, NULL);
|
||||
}
|
||||
|
||||
template <typename TypeName>
|
||||
TypeName* Unwrap(v8::Local<v8::Object> object) {
|
||||
assert(!object.IsEmpty());
|
||||
|
@ -112,6 +112,8 @@ inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
|
||||
|
||||
inline void Wrap(v8::Local<v8::Object> object, void* pointer);
|
||||
|
||||
inline void ClearWrap(v8::Local<v8::Object> object);
|
||||
|
||||
template <typename TypeName>
|
||||
inline TypeName* Unwrap(v8::Local<v8::Object> object);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user