Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d1a1e20

Browse files
committedMar 4, 2020
vm: migrate measureMemory to new v8 api
1 parent 535dc9b commit d1a1e20

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

‎src/node_contextify.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -1224,15 +1224,18 @@ static void MeasureMemory(const FunctionCallbackInfo<Value>& args) {
12241224
args[1].As<Object>());
12251225
CHECK_NOT_NULL(sandbox);
12261226
context = sandbox->context();
1227-
if (context.IsEmpty()) { // Not yet fully initilaized
1227+
if (context.IsEmpty()) { // Not yet fully initialized
12281228
return;
12291229
}
12301230
}
1231-
v8::Local<v8::Promise> promise;
1232-
if (!isolate->MeasureMemory(context, static_cast<v8::MeasureMemoryMode>(mode))
1233-
.ToLocal(&promise)) {
1234-
return;
1235-
}
1231+
Local<Promise::Resolver> resolver;
1232+
if (!Promise::Resolver::New(context).ToLocal(&resolver)) return;
1233+
std::unique_ptr<v8::MeasureMemoryDelegate> i =
1234+
v8::MeasureMemoryDelegate::Default(
1235+
isolate, context, resolver, static_cast<v8::MeasureMemoryMode>(mode));
1236+
CHECK_NOT_NULL(i);
1237+
v8::Local<v8::Promise> promise = resolver->GetPromise();
1238+
12361239
args.GetReturnValue().Set(promise);
12371240
}
12381241

0 commit comments

Comments
 (0)
Please sign in to comment.