diff options
Diffstat (limited to 'src/mbgl/storage/file_source_request.cpp')
-rw-r--r-- | src/mbgl/storage/file_source_request.cpp | 37 |
1 files changed, 0 insertions, 37 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 |