summaryrefslogtreecommitdiff
path: root/platform/node/src/util/async_queue.hpp
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/src/util/async_queue.hpp
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/src/util/async_queue.hpp')
-rw-r--r--platform/node/src/util/async_queue.hpp25
1 files changed, 10 insertions, 15 deletions
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