Skip to content

Commit 536cfec

Browse files
ofrobotsAli Sheikh
authored andcommitted
src: replace deprecated SetWeak in object_wrap
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>
1 parent 492fbfb commit 536cfec

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/node_object_wrap.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ObjectWrap {
6161

6262

6363
inline void MakeWeak(void) {
64-
persistent().SetWeak(this, WeakCallback);
64+
persistent().SetWeak(this, WeakCallback, v8::WeakCallbackType::kParameter);
6565
persistent().MarkIndependent();
6666
}
6767

@@ -96,14 +96,9 @@ class ObjectWrap {
9696

9797
private:
9898
static void WeakCallback(
99-
const v8::WeakCallbackData<v8::Object, ObjectWrap>& data) {
100-
v8::Isolate* isolate = data.GetIsolate();
101-
v8::HandleScope scope(isolate);
99+
const v8::WeakCallbackInfo<ObjectWrap>& data) {
102100
ObjectWrap* wrap = data.GetParameter();
103101
assert(wrap->refs_ == 0);
104-
assert(wrap->handle_.IsNearDeath());
105-
assert(
106-
data.GetValue() == v8::Local<v8::Object>::New(isolate, wrap->handle_));
107102
wrap->handle_.Reset();
108103
delete wrap;
109104
}

0 commit comments

Comments
 (0)