[node] Fix clang-tidy errors on the Node bindings headers
As reported by clang-tidy-8.
This commit is contained in:
@@ -66,7 +66,7 @@ public:
|
||||
for (uint32_t i = 0; i < names->Length(); ++i) {
|
||||
v8::Local<v8::Value> k = Nan::Get(names, i).ToLocalChecked();
|
||||
v8::Local<v8::Value> v = Nan::Get(Nan::To<v8::Object>(value).ToLocalChecked(), k).ToLocalChecked();
|
||||
optional<Error> result = fn(*Nan::Utf8String(k), std::move(v));
|
||||
optional<Error> result = fn(*Nan::Utf8String(k), std::move(v)); // NOLINT(performance-move-const-arg)
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -11,20 +11,17 @@
|
||||
#include <nan.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
using namespace mbgl::style::expression;
|
||||
|
||||
namespace node_mbgl {
|
||||
|
||||
v8::Local<v8::Value> toJS(const Value&);
|
||||
v8::Local<v8::Value> toJS(const mbgl::style::expression::Value&);
|
||||
|
||||
class NodeExpression : public Nan::ObjectWrap {
|
||||
public:
|
||||
static void Init(v8::Local<v8::Object>);
|
||||
|
||||
private:
|
||||
NodeExpression(std::unique_ptr<Expression> expression_) :
|
||||
expression(std::move(expression_))
|
||||
{};
|
||||
NodeExpression(std::unique_ptr<mbgl::style::expression::Expression> expression_)
|
||||
: expression(std::move(expression_)){};
|
||||
|
||||
static void New(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
static void Parse(const Nan::FunctionCallbackInfo<v8::Value>&);
|
||||
@@ -37,7 +34,7 @@ private:
|
||||
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
|
||||
std::unique_ptr<Expression> expression;
|
||||
std::unique_ptr<mbgl::style::expression::Expression> expression;
|
||||
};
|
||||
|
||||
} // namespace node_mbgl
|
||||
|
||||
@@ -17,13 +17,10 @@ namespace util { template <typename T> class AsyncQueue; }
|
||||
class NodeLogObserver : public mbgl::Log::Observer {
|
||||
public:
|
||||
NodeLogObserver(v8::Local<v8::Object> target);
|
||||
~NodeLogObserver();
|
||||
~NodeLogObserver() override;
|
||||
|
||||
// Log::Observer implementation
|
||||
virtual bool onRecord(mbgl::EventSeverity severity,
|
||||
mbgl::Event event,
|
||||
int64_t code,
|
||||
const std::string& text) override;
|
||||
bool onRecord(mbgl::EventSeverity severity, mbgl::Event event, int64_t code, const std::string& text) override;
|
||||
|
||||
private:
|
||||
Nan::Persistent<v8::Object> module;
|
||||
@@ -32,4 +29,4 @@ private:
|
||||
util::AsyncQueue<LogMessage>* queue;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace node_mbgl
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
class RenderWorker;
|
||||
|
||||
NodeMap(v8::Local<v8::Object>);
|
||||
~NodeMap();
|
||||
~NodeMap() override;
|
||||
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
static Nan::Persistent<v8::Object> parseError;
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
struct NodeFileSource : public mbgl::FileSource {
|
||||
NodeFileSource(NodeMap* nodeMap_) : nodeMap(nodeMap_) {}
|
||||
~NodeFileSource() = default;
|
||||
~NodeFileSource() override = default;
|
||||
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&, mbgl::FileSource::Callback) final;
|
||||
bool canRequest(const mbgl::Resource&) const override;
|
||||
NodeMap* nodeMap;
|
||||
|
||||
@@ -137,7 +137,7 @@ void NodeRequest::unrefRequest() {
|
||||
Unref();
|
||||
}
|
||||
|
||||
NodeAsyncRequest::NodeAsyncRequest() : request(nullptr) {}
|
||||
NodeAsyncRequest::NodeAsyncRequest() = default;
|
||||
|
||||
NodeAsyncRequest::~NodeAsyncRequest() {
|
||||
if (request) {
|
||||
|
||||
@@ -17,7 +17,7 @@ class NodeRequest;
|
||||
struct NodeAsyncRequest : public mbgl::AsyncRequest {
|
||||
NodeAsyncRequest();
|
||||
~NodeAsyncRequest() override;
|
||||
NodeRequest* request;
|
||||
NodeRequest* request = nullptr;
|
||||
};
|
||||
|
||||
class NodeRequest : public Nan::ObjectWrap {
|
||||
@@ -25,7 +25,7 @@ class NodeRequest : public Nan::ObjectWrap {
|
||||
public:
|
||||
|
||||
NodeRequest(mbgl::FileSource::Callback, NodeAsyncRequest*);
|
||||
~NodeRequest();
|
||||
~NodeRequest() override;
|
||||
|
||||
static Nan::Persistent<v8::Function> constructor;
|
||||
|
||||
@@ -41,4 +41,4 @@ public:
|
||||
Nan::AsyncResource* asyncResource = new Nan::AsyncResource("mbgl:execute");
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace node_mbgl
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
namespace node_mbgl {
|
||||
namespace util {
|
||||
@@ -14,8 +15,7 @@ namespace util {
|
||||
template <typename T>
|
||||
class AsyncQueue {
|
||||
public:
|
||||
AsyncQueue(uv_loop_t *loop, std::function<void(T &)> fn) :
|
||||
callback(fn) {
|
||||
AsyncQueue(uv_loop_t *loop, std::function<void(T &)> fn) : callback(std::move(fn)) {
|
||||
async.data = this;
|
||||
uv_async_init(loop, &async, [](uv_async_t* handle) {
|
||||
auto q = reinterpret_cast<AsyncQueue *>(handle->data);
|
||||
@@ -41,18 +41,13 @@ public:
|
||||
}
|
||||
|
||||
void stop() {
|
||||
uv_close((uv_handle_t *)&async, [](uv_handle_t *handle) {
|
||||
delete reinterpret_cast<AsyncQueue *>(handle->data);
|
||||
});
|
||||
uv_close(reinterpret_cast<uv_handle_t *>(&async),
|
||||
[](uv_handle_t *handle) { delete reinterpret_cast<AsyncQueue *>(handle->data); });
|
||||
}
|
||||
|
||||
void ref() {
|
||||
uv_ref((uv_handle_t *)&async);
|
||||
}
|
||||
void ref() { uv_ref(reinterpret_cast<uv_handle_t *>(&async)); }
|
||||
|
||||
void unref() {
|
||||
uv_unref((uv_handle_t *)&async);
|
||||
}
|
||||
void unref() { uv_unref(reinterpret_cast<uv_handle_t *>(&async)); }
|
||||
|
||||
private:
|
||||
void process() {
|
||||
@@ -77,5 +72,5 @@ private:
|
||||
std::function<void(T &)> callback;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace util
|
||||
} // namespace node_mbgl
|
||||
|
||||
Reference in New Issue
Block a user