Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
update deprecated callback->Call call
Browse files Browse the repository at this point in the history
  • Loading branch information
karenzshea committed Mar 9, 2018
1 parent 472ce4f commit 9717d38
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@mapbox/cloudfriend": "^1.9.0",
"aws-sdk": "^2.3.5",
"nan": "^2.2.1",
"nan": "^2.9.0",
"node-cmake": "^1.2.0",
"node-pre-gyp": "^0.6.26",
"tape": "^4.6.3"
Expand Down
23 changes: 13 additions & 10 deletions src/nodejs_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ NAN_METHOD(Annotator::loadOSMExtract)
{
//std::cout << std::string(file_array->Get(idx)->ToString() << std::endl;
if (!file_array->Get(idx)->IsString())
return Nan::ThrowError("Unable to convert file path to Utf8String at place " + idx);
{
// TODO include the idx number in this error message
return Nan::ThrowError("Unable to convert file path to Utf8String");
}

const v8::String::Utf8Value file{file_array->Get(idx)};
if (!(*file))
return Nan::ThrowError("Unable to convert file path to Utf8String at place " + idx);
return Nan::ThrowError("Unable to convert file path to Utf8String");
osm_paths.emplace_back(*file, file.length());
}
}
Expand All @@ -147,7 +150,7 @@ NAN_METHOD(Annotator::loadOSMExtract)
Nan::Callback *callback,
std::vector<std::string> osm_paths_,
std::string tag_path_)
: Nan::AsyncWorker(callback), self{self_}, osm_paths{std::move(osm_paths_)},
: Nan::AsyncWorker(callback, "annotator:osm.load"), self{self_}, osm_paths{std::move(osm_paths_)},
tag_path{tag_path_}
{
}
Expand Down Expand Up @@ -176,7 +179,7 @@ NAN_METHOD(Annotator::loadOSMExtract)
Nan::HandleScope scope;
const constexpr auto argc = 1u;
v8::Local<v8::Value> argv[argc] = {Nan::Null()};
callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

Annotator &self;
Expand Down Expand Up @@ -234,7 +237,7 @@ NAN_METHOD(Annotator::annotateRouteFromNodeIds)
explicit WayIdsFromNodeIdsLoader(Annotator &self_,
Nan::Callback *callback,
std::vector<external_nodeid_t> externalIds_)
: Nan::AsyncWorker(callback), self{self_}, externalIds{std::move(externalIds_)}
: Nan::AsyncWorker(callback, "annotator:osm.annotatefromnodeids"), self{self_}, externalIds{std::move(externalIds_)}
{
}

Expand Down Expand Up @@ -263,7 +266,7 @@ NAN_METHOD(Annotator::annotateRouteFromNodeIds)
const constexpr auto argc = 2u;
v8::Local<v8::Value> argv[argc] = {Nan::Null(), annotated};

callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

Annotator &self;
Expand Down Expand Up @@ -322,7 +325,7 @@ NAN_METHOD(Annotator::annotateRouteFromLonLats)
explicit WayIdsFromLonLatsLoader(Annotator &self_,
Nan::Callback *callback,
std::vector<point_t> coordinates_)
: Nan::AsyncWorker(callback), self{self_}, coordinates{std::move(coordinates_)}
: Nan::AsyncWorker(callback, "annotator:osm.annotatefromlonlats"), self{self_}, coordinates{std::move(coordinates_)}
{
}

Expand Down Expand Up @@ -362,7 +365,7 @@ NAN_METHOD(Annotator::annotateRouteFromLonLats)
const constexpr auto argc = 2u;
v8::Local<v8::Value> argv[argc] = {Nan::Null(), annotated};

callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

Annotator &self;
Expand All @@ -389,7 +392,7 @@ NAN_METHOD(Annotator::getAllTagsForWayId)
struct TagsForWayIdLoader final : Nan::AsyncWorker
{
explicit TagsForWayIdLoader(Annotator &self_, Nan::Callback *callback, wayid_t wayId_)
: Nan::AsyncWorker(callback), self{self_}, wayId{std::move(wayId_)}
: Nan::AsyncWorker(callback, "annotator:osm.gettagsforids"), self{self_}, wayId{std::move(wayId_)}
{
}

Expand All @@ -413,7 +416,7 @@ NAN_METHOD(Annotator::getAllTagsForWayId)
const constexpr auto argc = 2u;
v8::Local<v8::Value> argv[argc] = {Nan::Null(), tags};

callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

Annotator &self;
Expand Down
8 changes: 4 additions & 4 deletions src/speed_lookup_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ NAN_METHOD(SpeedLookup::loadCSV)
explicit CSVLoader(v8::Local<v8::Object> self_,
Nan::Callback *callback,
std::vector<std::string> paths_)
: Nan::AsyncWorker(callback), paths{std::move(paths_)}
: Nan::AsyncWorker(callback, "annotator:speed.load"), paths{std::move(paths_)}
{
SaveToPersistent("self", self_);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ NAN_METHOD(SpeedLookup::loadCSV)
swap(unwrapped->datamap, map);
const constexpr auto argc = 1u;
v8::Local<v8::Value> argv[argc] = {Nan::Null()};
callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

std::vector<std::string> paths;
Expand Down Expand Up @@ -176,7 +176,7 @@ NAN_METHOD(SpeedLookup::getRouteSpeeds)
Worker(std::shared_ptr<SegmentSpeedMap> datamap_,
Nan::Callback *callback,
std::vector<external_nodeid_t> nodeIds)
: Base(callback), datamap{datamap_}, nodeIds(std::move(nodeIds))
: Base(callback, "annotator:speed.annotatefromnodeids"), datamap{datamap_}, nodeIds(std::move(nodeIds))
{
}

Expand Down Expand Up @@ -208,7 +208,7 @@ NAN_METHOD(SpeedLookup::getRouteSpeeds)
const auto argc = 2u;
v8::Local<v8::Value> argv[argc] = {Nan::Null(), jsAnnotations};

callback->Call(argc, argv);
callback->Call(argc, argv, async_resource);
}

std::shared_ptr<SegmentSpeedMap> datamap;
Expand Down

0 comments on commit 9717d38

Please sign in to comment.