summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-09-25 21:35:04 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-09-28 13:48:36 -0400
commit64c75b442c4d387e4867757abf49462c561e5955 (patch)
tree63f572961f6309a851d2e85ebe191e6a3cb7e5ab /src
parentd73e33eb62858b91212314d97bfe9cf49e857141 (diff)
downloadqtlocation-mapboxgl-64c75b442c4d387e4867757abf49462c561e5955.tar.gz
[build] split out DefaultFileSource and dependents to a separate target
We don't want to link it into the node bindings, so keep it in a separate target
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/storage/file_source_request.cpp37
-rw-r--r--src/mbgl/storage/file_source_request.hpp31
-rw-r--r--src/mbgl/util/http_timeout.cpp2
3 files changed, 2 insertions, 68 deletions
diff --git a/src/mbgl/storage/file_source_request.cpp b/src/mbgl/storage/file_source_request.cpp
deleted file mode 100644
index 09ea8cc32a..0000000000
--- a/src/mbgl/storage/file_source_request.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <mbgl/storage/file_source_request.hpp>
-
-#include <mbgl/actor/mailbox.hpp>
-#include <mbgl/actor/scheduler.hpp>
-
-namespace mbgl {
-
-FileSourceRequest::FileSourceRequest(FileSource::Callback&& callback)
- : responseCallback(callback)
- , mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent())) {
-}
-
-FileSourceRequest::~FileSourceRequest() {
- if (cancelCallback) {
- cancelCallback();
- }
-
- mailbox->close();
-}
-
-void FileSourceRequest::onCancel(std::function<void()>&& callback) {
- cancelCallback = std::move(callback);
-}
-
-void FileSourceRequest::setResponse(const Response& response) {
- // Copy, because calling the callback will sometimes self
- // destroy this object. We cannot move because this method
- // can be called more than one.
- auto callback = responseCallback;
- callback(response);
-}
-
-ActorRef<FileSourceRequest> FileSourceRequest::actor() {
- return ActorRef<FileSourceRequest>(*this, mailbox);
-}
-
-} // namespace mbgl
diff --git a/src/mbgl/storage/file_source_request.hpp b/src/mbgl/storage/file_source_request.hpp
deleted file mode 100644
index 6bd0d44df6..0000000000
--- a/src/mbgl/storage/file_source_request.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#pragma once
-
-#include <mbgl/actor/actor_ref.hpp>
-#include <mbgl/storage/file_source.hpp>
-#include <mbgl/util/async_request.hpp>
-
-#include <memory>
-#include <functional>
-
-namespace mbgl {
-
-class Mailbox;
-
-class FileSourceRequest : public AsyncRequest {
-public:
- FileSourceRequest(FileSource::Callback&& callback);
- ~FileSourceRequest() final;
-
- void onCancel(std::function<void()>&& callback);
- void setResponse(const Response& res);
-
- ActorRef<FileSourceRequest> actor();
-
-private:
- FileSource::Callback responseCallback = nullptr;
- std::function<void()> cancelCallback = nullptr;
-
- std::shared_ptr<Mailbox> mailbox;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/util/http_timeout.cpp b/src/mbgl/util/http_timeout.cpp
index ca9a93498f..3456369250 100644
--- a/src/mbgl/util/http_timeout.cpp
+++ b/src/mbgl/util/http_timeout.cpp
@@ -1,6 +1,8 @@
#include <mbgl/util/http_timeout.hpp>
#include <mbgl/util/constants.hpp>
+#include <cassert>
+
namespace mbgl {
namespace http {