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: nodejs#5494
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: targos - Michaël Zasso <[email protected]>
  • Loading branch information
ofrobots authored and Ali Sheikh committed Mar 3, 2016
1 parent 8b64715 commit fc05e2d
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 fc05e2d

Please sign in to comment.