Skip to content

Commit

Permalink
src: replace deprecated SetWeak in object_wrap
Browse files Browse the repository at this point in the history
Migrate node_object_wrap.h to the new SetWeak API.

PR-URL: #5494
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
  • Loading branch information
ofrobots authored and Ali Sheikh committed Mar 4, 2016
1 parent 492fbfb commit 536cfec
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/node_object_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ObjectWrap {


inline void MakeWeak(void) {
persistent().SetWeak(this, WeakCallback);
persistent().SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter);
persistent().MarkIndependent();
}

Expand Down Expand Up @@ -96,14 +96,9 @@ class ObjectWrap {

private:
static void WeakCallback(
const v8::WeakCallbackData<v8::Object, ObjectWrap>& data) {
v8::Isolate* isolate = data.GetIsolate();
v8::HandleScope scope(isolate);
const v8::WeakCallbackInfo<ObjectWrap>& data) {
ObjectWrap* wrap = data.GetParameter();
assert(wrap->refs_ == 0);
assert(wrap->handle_.IsNearDeath());
assert(
data.GetValue() == v8::Local<v8::Object>::New(isolate, wrap->handle_));
wrap->handle_.Reset();
delete wrap;
}
Expand Down

0 comments on commit 536cfec

Please sign in to comment.