summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-04-05 13:16:38 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-04-17 13:36:50 +0300
commitc570c7322da87139b49ba0d71f799590a2ed38ad (patch)
treef967e96f5d3676fb798a0725274490cade29dca5 /platform/node
parentea2477f2ea9f1ccebe0263104ad13d729fdbcfdf (diff)
downloadqtlocation-mapboxgl-c570c7322da87139b49ba0d71f799590a2ed38ad.tar.gz
[node] Fix clang-tidy errors on the Node bindings headers
As reported by clang-tidy-8.
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_conversion.hpp2
-rw-r--r--platform/node/src/node_expression.hpp11
-rw-r--r--platform/node/src/node_logging.hpp9
-rw-r--r--platform/node/src/node_map.hpp4
-rw-r--r--platform/node/src/node_request.cpp2
-rw-r--r--platform/node/src/node_request.hpp6
-rw-r--r--platform/node/src/util/async_queue.hpp25
7 files changed, 24 insertions, 35 deletions
diff --git a/platform/node/src/node_conversion.hpp b/platform/node/src/node_conversion.hpp
index ea6652c5e2..7f6625c6df 100644
--- a/platform/node/src/node_conversion.hpp
+++ b/platform/node/src/node_conversion.hpp
@@ -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;
}
diff --git a/platform/node/src/node_expression.hpp b/platform/node/src/node_expression.hpp
index a53f8c18db..4b93b59d52 100644
--- a/platform/node/src/node_expression.hpp
+++ b/platform/node/src/node_expression.hpp
@@ -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
diff --git a/platform/node/src/node_logging.hpp b/platform/node/src/node_logging.hpp
index e01f8cbafd..67f4ace079 100644
--- a/platform/node/src/node_logging.hpp
+++ b/platform/node/src/node_logging.hpp
@@ -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
diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp
index 29c4547b24..2c7aa25390 100644
--- a/platform/node/src/node_map.hpp
+++ b/platform/node/src/node_map.hpp
@@ -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;
diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp
index 17e3053529..981f9d1e81 100644
--- a/platform/node/src/node_request.cpp
+++ b/platform/node/src/node_request.cpp
@@ -137,7 +137,7 @@ void NodeRequest::unrefRequest() {
Unref();
}
-NodeAsyncRequest::NodeAsyncRequest() : request(nullptr) {}
+NodeAsyncRequest::NodeAsyncRequest() = default;
NodeAsyncRequest::~NodeAsyncRequest() {
if (request) {
diff --git a/platform/node/src/node_request.hpp b/platform/node/src/node_request.hpp
index a7c2545fc2..f958700b05 100644
--- a/platform/node/src/node_request.hpp
+++ b/platform/node/src/node_request.hpp
@@ -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
diff --git a/platform/node/src/util/async_queue.hpp b/platform/node/src/util/async_queue.hpp
index e9d9e23626..adf40e3ff5 100644
--- a/platform/node/src/util/async_queue.hpp
+++ b/platform/node/src/util/async_queue.hpp
@@ -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