[core] only perform optional requests if the FileSource supports it
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user