diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-10-09 12:59:27 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-10-12 10:41:49 +0200 |
commit | f4cb3b8a4f70723f22d89b163160dc1a28d8d8a0 (patch) | |
tree | e41558bee74394c181664cf6047abad8a8cb7a2d /include/mbgl/storage/file_source.hpp | |
parent | 98a47884f06a8f165a2c15a54f82b356c8ef23d8 (diff) | |
download | qtlocation-mapboxgl-f4cb3b8a4f70723f22d89b163160dc1a28d8d8a0.tar.gz |
[core] make forcing cache/network only more explicit
Previously, we used the existence of a `prior*` field in the Resource object as an indication for whether we should consult the cache or not. However, this is prone to error, since a failed cache lookup won't set any prior fields. Therefore, we manually set `priorExpires` to 0. This in turn triggered another bug where generated wrong expiration timestamps when the server response we got was expired (or expired between sending and receiving).
This commit changes the flags so that we can now explicitly request CacheOnly/NetworkOnly (or All) loading methods, rather than the implicit Optional/Required naming scheme.
Diffstat (limited to 'include/mbgl/storage/file_source.hpp')
-rw-r--r-- | include/mbgl/storage/file_source.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp index 404c683fdb..0709a1c245 100644 --- a/include/mbgl/storage/file_source.hpp +++ b/include/mbgl/storage/file_source.hpp @@ -24,11 +24,11 @@ public: // 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. + // When a file source supports consulting a local cache only, it must return true. + // Cache-only 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 { + virtual bool supportsCacheOnlyRequests() const { return false; } }; |