summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-03-23 17:31:14 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-03-24 10:54:32 -0700
commit169755e89a72b103fab100ccd101013e8eef1481 (patch)
tree5716e13519fe2b7f5c91cccbdbf14635a1ef117d /include/mbgl/util
parent7ff074889e826f766028ba582beb677b39d16bec (diff)
downloadqtlocation-mapboxgl-169755e89a72b103fab100ccd101013e8eef1481.tar.gz
[core] Unify FileRequest and WorkRequest
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/async_request.hpp12
-rw-r--r--include/mbgl/util/run_loop.hpp4
-rw-r--r--include/mbgl/util/work_request.hpp6
3 files changed, 17 insertions, 5 deletions
diff --git a/include/mbgl/util/async_request.hpp b/include/mbgl/util/async_request.hpp
new file mode 100644
index 0000000000..9e85094966
--- /dev/null
+++ b/include/mbgl/util/async_request.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <mbgl/util/noncopyable.hpp>
+
+namespace mbgl {
+
+class AsyncRequest : private util::noncopyable {
+public:
+ virtual ~AsyncRequest() = default;
+};
+
+} // namespace mbgl
diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp
index fbc4794940..4e25caf554 100644
--- a/include/mbgl/util/run_loop.hpp
+++ b/include/mbgl/util/run_loop.hpp
@@ -58,7 +58,7 @@ public:
// Post the cancellable work fn(args...) to this RunLoop.
template <class Fn, class... Args>
- std::unique_ptr<WorkRequest>
+ std::unique_ptr<AsyncRequest>
invokeCancellable(Fn&& fn, Args&&... args) {
auto flag = std::make_shared<std::atomic<bool>>();
*flag = false;
@@ -76,7 +76,7 @@ public:
// Invoke fn(args...) on this RunLoop, then invoke callback(results...) on the current RunLoop.
template <class Fn, class Cb, class... Args>
- std::unique_ptr<WorkRequest>
+ std::unique_ptr<AsyncRequest>
invokeWithCallback(Fn&& fn, Cb&& callback, Args&&... args) {
auto flag = std::make_shared<std::atomic<bool>>();
*flag = false;
diff --git a/include/mbgl/util/work_request.hpp b/include/mbgl/util/work_request.hpp
index bd1d97ee70..f24e4b2e9f 100644
--- a/include/mbgl/util/work_request.hpp
+++ b/include/mbgl/util/work_request.hpp
@@ -1,7 +1,7 @@
#ifndef MBGL_UTIL_WORK_REQUEST
#define MBGL_UTIL_WORK_REQUEST
-#include <mbgl/util/noncopyable.hpp>
+#include <mbgl/util/async_request.hpp>
#include <memory>
@@ -9,11 +9,11 @@ namespace mbgl {
class WorkTask;
-class WorkRequest : public util::noncopyable {
+class WorkRequest : public AsyncRequest {
public:
using Task = std::shared_ptr<WorkTask>;
WorkRequest(Task);
- ~WorkRequest();
+ ~WorkRequest() override;
private:
std::shared_ptr<WorkTask> task;