[node] Fix memory test hanging after GlyphAtlas refactoring (#8394)

Replies are assumed to be asynchronous after e3500c1f79.
This commit is contained in:
Thiago Marcos P. Santos
2017-03-14 22:19:58 +02:00
committed by Bobby Sudekum
parent bd05bcfe9f
commit 5700c99e55
4 changed files with 73 additions and 37 deletions

View File

@@ -122,9 +122,19 @@ void NodeRequest::HandleCallback(const Nan::FunctionCallbackInfo<v8::Value>& inf
}
void NodeRequest::Execute() {
asyncExecute = std::make_unique<mbgl::util::AsyncTask>([this] { doExecute(); Unref(); });
asyncExecute->send();
Ref();
}
void NodeRequest::doExecute() {
Nan::HandleScope scope;
v8::Local<v8::Value> argv[] = { handle() };
Nan::MakeCallback(Nan::To<v8::Object>(target->handle()->GetInternalField(1)).ToLocalChecked(), "request", 1, argv);
asyncExecute.reset();
}
NodeRequest::NodeAsyncRequest::NodeAsyncRequest(NodeRequest* request_) : request(request_) {