Revert "[node] Destroy the RunLoop with the last Map object"

This reverts commit 3633fd7ebd.
This commit is contained in:
Thiago Marcos P. Santos
2016-02-23 15:25:12 +02:00
parent 931ac77af4
commit 63982e0010
4 changed files with 10 additions and 18 deletions

View File

@@ -439,7 +439,6 @@ void NodeMap::release() {
});
map.reset(nullptr);
loop.reset();
}
NAN_METHOD(NodeMap::DumpDebugLogs) {
@@ -459,7 +458,6 @@ NodeMap::NodeMap(v8::Local<v8::Object> options) :
Nan::HandleScope scope;
return Nan::Has(options, Nan::New("ratio").ToLocalChecked()).FromJust() ? Nan::Get(options, Nan::New("ratio").ToLocalChecked()).ToLocalChecked()->NumberValue() : 1.0;
}()),
loop(NodeRunLoop()),
map(std::make_unique<mbgl::Map>(view, *this, mbgl::MapMode::Still)),
async(new uv_async_t) {
@@ -486,7 +484,7 @@ std::unique_ptr<mbgl::FileRequest> NodeMap::request(const mbgl::Resource& resour
// This function can be called from any thread. Make sure we're executing the
// JS implementation in the node event loop.
req->workRequest = loop->invokeWithCallback([this] (mbgl::Resource res, Callback cb2) {
req->workRequest = NodeRunLoop().invokeWithCallback([this] (mbgl::Resource res, Callback cb2) {
Nan::HandleScope scope;
auto requestHandle = NodeRequest::Create(res, cb2)->ToObject();