@@ -37,7 +37,6 @@ target_include_directories(
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/platform/default/include
|
||||
${PROJECT_SOURCE_DIR}/src
|
||||
${PROJECT_SOURCE_DIR}/vendor/nontype_functional/include
|
||||
PRIVATE ${LIBUV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
@@ -45,7 +44,6 @@ target_link_libraries(
|
||||
mbgl-node-loop
|
||||
PUBLIC
|
||||
Mapbox::Base
|
||||
INTERFACE mbgl-vendor-nontype_functional
|
||||
)
|
||||
|
||||
target_sources(
|
||||
@@ -70,7 +68,6 @@ target_link_libraries(
|
||||
mbgl-node
|
||||
INTERFACE mbgl-node-loop
|
||||
INTERFACE Mapbox::Map
|
||||
INTERFACE mbgl-vendor-nontype_functional
|
||||
)
|
||||
|
||||
# FIXME: Node bindings only run fully on Linux now because it requires libuv RunLoop (which is the default on Linux). Also, Sanitizer will
|
||||
|
||||
@@ -1537,7 +1537,7 @@ NodeMap::~NodeMap() {
|
||||
}
|
||||
|
||||
std::unique_ptr<mbgl::AsyncRequest> NodeFileSource::request(const mbgl::Resource& resource,
|
||||
std::function<void(mbgl::Response)> callback_) {
|
||||
mbgl::FileSource::Callback callback_) {
|
||||
assert(nodeMap);
|
||||
|
||||
Nan::HandleScope scope;
|
||||
|
||||
@@ -103,7 +103,7 @@ struct NodeFileSource : public mbgl::FileSource {
|
||||
NodeFileSource(NodeMap* nodeMap_)
|
||||
: nodeMap(nodeMap_) {}
|
||||
~NodeFileSource() override = default;
|
||||
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&, std::function<void(mbgl::Response)>) final;
|
||||
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&, mbgl::FileSource::Callback) final;
|
||||
bool canRequest(const mbgl::Resource&) const override;
|
||||
void setResourceOptions(mbgl::ResourceOptions) override;
|
||||
mbgl::ResourceOptions getResourceOptions() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace node_mbgl {
|
||||
|
||||
NodeRequest::NodeRequest(std::function<void(mbgl::Response)> callback_, NodeAsyncRequest* asyncRequest_)
|
||||
NodeRequest::NodeRequest(mbgl::FileSource::Callback callback_, NodeAsyncRequest* asyncRequest_)
|
||||
: callback(std::move(callback_)),
|
||||
asyncRequest(asyncRequest_) {
|
||||
asyncRequest->request = this;
|
||||
@@ -42,7 +42,7 @@ void NodeRequest::Init(v8::Local<v8::Object> target) {
|
||||
|
||||
void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) {
|
||||
auto target = reinterpret_cast<NodeMap*>(info[0].As<v8::External>()->Value());
|
||||
auto callback = reinterpret_cast<std::function<void(mbgl::Response)>*>(info[1].As<v8::External>()->Value());
|
||||
auto callback = reinterpret_cast<mbgl::FileSource::Callback*>(info[1].As<v8::External>()->Value());
|
||||
auto asyncRequest = reinterpret_cast<NodeAsyncRequest*>(info[2].As<v8::External>()->Value());
|
||||
|
||||
auto request = new NodeRequest(*callback, asyncRequest);
|
||||
|
||||
@@ -22,7 +22,7 @@ struct NodeAsyncRequest : public mbgl::AsyncRequest {
|
||||
|
||||
class NodeRequest : public Nan::ObjectWrap {
|
||||
public:
|
||||
NodeRequest(std::function<void(mbgl::Response)>, NodeAsyncRequest*);
|
||||
NodeRequest(mbgl::FileSource::Callback, NodeAsyncRequest*);
|
||||
~NodeRequest() override;
|
||||
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void unrefRequest();
|
||||
|
||||
std::function<void(mbgl::Response)> callback;
|
||||
mbgl::FileSource::Callback callback;
|
||||
NodeAsyncRequest* asyncRequest;
|
||||
Nan::AsyncResource* asyncResource = new Nan::AsyncResource("mbgl:execute");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user