diff options
author | Mike Morris <mikemorris@users.noreply.github.com> | 2016-07-12 22:34:51 -0400 |
---|---|---|
committer | Mike Morris <mikemorris@users.noreply.github.com> | 2016-07-13 00:02:14 -0400 |
commit | fc3cfef5ab579ab984d83e610d3886fe39f250d2 (patch) | |
tree | e444fcfc32abcb971cf7d423d1a8ce061e768815 | |
parent | 43cf669c6b87dd6747e4e61d0cad53382e497be2 (diff) | |
download | qtlocation-mapboxgl-fc3cfef5ab579ab984d83e610d3886fe39f250d2.tar.gz |
[node] drop Request from public API
-rw-r--r-- | platform/node/src/node_mapbox_gl_native.cpp | 2 | ||||
-rw-r--r-- | platform/node/src/node_request.cpp | 9 | ||||
-rw-r--r-- | platform/node/src/node_request.hpp | 2 |
3 files changed, 4 insertions, 9 deletions
diff --git a/platform/node/src/node_mapbox_gl_native.cpp b/platform/node/src/node_mapbox_gl_native.cpp index 26c49918be..a743ed9aa5 100644 --- a/platform/node/src/node_mapbox_gl_native.cpp +++ b/platform/node/src/node_mapbox_gl_native.cpp @@ -19,7 +19,7 @@ void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module) nodeRunLoop.stop(); node_mbgl::NodeMap::Init(target); - node_mbgl::NodeRequest::Init(target); + node_mbgl::NodeRequest::Init(); // Exports Resource constants. v8::Local<v8::Object> resource = Nan::New<v8::Object>(); diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp index d7931ac572..252279a592 100644 --- a/platform/node/src/node_request.cpp +++ b/platform/node/src/node_request.cpp @@ -26,14 +26,13 @@ NodeRequest::~NodeRequest() { Nan::Persistent<v8::Function> NodeRequest::constructor; -NAN_MODULE_INIT(NodeRequest::Init) { +void NodeRequest::Init() { v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New); tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->SetClassName(Nan::New("Request").ToLocalChecked()); constructor.Reset(tpl->GetFunction()); - Nan::Set(target, Nan::New("Request").ToLocalChecked(), tpl->GetFunction()); } void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) { @@ -47,16 +46,12 @@ void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) { } void NodeRequest::Execute() { - Nan::HandleScope handleScope; - // Enter a new v8::Context to avoid leaking v8::FunctionTemplate // from Nan::New<v8::Function> v8::Local<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent()); v8::Context::Scope scope(context); - auto fn = Nan::New<v8::Function>(NodeRequest::Respond, handle()); - - v8::Local<v8::Value> argv[] = { handle(), fn }; + v8::Local<v8::Value> argv[] = { handle(), Nan::New<v8::Function>(NodeRequest::Respond, handle()) }; Nan::MakeCallback(Nan::To<v8::Object>(target->handle()->GetInternalField(1)).ToLocalChecked(), "request", 2, argv); } diff --git a/platform/node/src/node_request.hpp b/platform/node/src/node_request.hpp index e6df54bb1f..b1a5d039ed 100644 --- a/platform/node/src/node_request.hpp +++ b/platform/node/src/node_request.hpp @@ -20,7 +20,7 @@ public: static Nan::Persistent<v8::Function> constructor; - static NAN_MODULE_INIT(Init); + static void Init(); static void New(const Nan::FunctionCallbackInfo<v8::Value>&); static NAN_METHOD(Respond); |