[core] only perform optional requests if the FileSource supports it

This commit is contained in:
Konstantin Käfer
2016-05-27 13:37:41 +02:00
parent f180179d1b
commit 91895b9aec
4 changed files with 50 additions and 14 deletions

View File

@@ -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;

View File

@@ -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