summaryrefslogtreecommitdiff
path: root/include/mbgl/storage
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-05-27 13:37:41 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-06-10 12:42:14 +0200
commit91895b9aecedc9c080e18b2e7304f5d2a8da340a (patch)
tree7ffce27fdd12aa2092f07873603e07e48ea489ca /include/mbgl/storage
parentf180179d1b98e6610263b71ea0d9ef7f44725005 (diff)
downloadqtlocation-mapboxgl-91895b9aecedc9c080e18b2e7304f5d2a8da340a.tar.gz
[core] only perform optional requests if the FileSource supports it
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r--include/mbgl/storage/default_file_source.hpp4
-rw-r--r--include/mbgl/storage/file_source.hpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index e77befda1b..235e738254 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -26,6 +26,10 @@ public:
uint64_t maximumCacheSize = util::DEFAULT_MAX_CACHE_SIZE);
~DefaultFileSource() override;
+ bool supportsOptionalRequests() const override {
+ return true;
+ }
+
void setAccessToken(const std::string&);
std::string getAccessToken() const;
diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp
index 88e0336187..404c683fdb 100644
--- a/include/mbgl/storage/file_source.hpp
+++ b/include/mbgl/storage/file_source.hpp
@@ -23,6 +23,14 @@ public:
// If the request is cancelled before the callback is executed, the callback will
// not be executed.
virtual std::unique_ptr<AsyncRequest> request(const Resource&, Callback) = 0;
+
+ // When a file source supports optional requests, it must return true.
+ // Optional requests are requests that aren't as urgent, but could be useful, e.g.
+ // to cover part of the map while loading. The FileSource should only do cheap actions to
+ // retrieve the data, e.g. load it from a cache, but not from the internet.
+ virtual bool supportsOptionalRequests() const {
+ return false;
+ }
};
} // namespace mbgl