diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-06-21 17:39:29 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-06-26 16:32:21 +0300 |
commit | ea34cb5725815dbb5075205b01407a00329a3542 (patch) | |
tree | 43f6eb33f444eaa4420a99a1bb93ab17e711af8e /include/mbgl/storage/online_file_source.hpp | |
parent | 515ffa975d027c7c1479b2d0211e798c25148d60 (diff) | |
download | qtlocation-mapboxgl-ea34cb5725815dbb5075205b01407a00329a3542.tar.gz |
[core] Use the ResourceTransform instead of callbacks
Based on the actor model, can be considered safer to use since
we don't need to worry about object lifetime anymore.
Diffstat (limited to 'include/mbgl/storage/online_file_source.hpp')
-rw-r--r-- | include/mbgl/storage/online_file_source.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp index 51cfc5a2a1..ffd75662e6 100644 --- a/include/mbgl/storage/online_file_source.hpp +++ b/include/mbgl/storage/online_file_source.hpp @@ -1,10 +1,14 @@ #pragma once +#include <mbgl/actor/actor_ref.hpp> #include <mbgl/storage/file_source.hpp> #include <mbgl/util/constants.hpp> +#include <mbgl/util/optional.hpp> namespace mbgl { +class ResourceTransform; + class OnlineFileSource : public FileSource { public: OnlineFileSource(); @@ -16,9 +20,7 @@ public: void setAccessToken(const std::string& t) { accessToken = t; } std::string getAccessToken() const { return accessToken; } - using ResourceTransform = - std::function<std::unique_ptr<AsyncRequest>(Resource::Kind, std::string&&, std::function<void(std::string&&)>)>; - void setResourceTransform(ResourceTransform&& cb); + void setResourceTransform(optional<ActorRef<ResourceTransform>>&&); std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; |