Browse Source

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>
v0.11.14-release
Ben Noordhuis 10 years ago
committed by Trevor Norris
parent
commit
1e99486cc8
  1. 4
      src/util-inl.h
  2. 2
      src/util.h

4
src/util-inl.h

@ -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());

2
src/util.h

@ -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…
Cancel
Save