Commit Graph

9 Commits

Author SHA1 Message Date
Łukasz Paczos
46ef2d86d2 [core] invoke optional resource path change completion listener 2019-05-24 15:03:55 +02:00
Huyen Chau Nguyen
1e3a744d22 [core] add priorities to resources
- priorities can be low or regular
- offline downloads should have low priority to not throttle "regular requests"
2018-10-23 12:47:10 +02:00
Konstantin Käfer
f4cb3b8a4f [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.
2017-10-12 10:41:49 +02:00
Konstantin Käfer
f281e6ae8a [core] fix loading of stale must-revalidate resources
In https://github.com/mapbox/mapbox-gl-native/pull/9670, we implemented support for the Cache-Control: must-revalidate header. While we now respect this header and don't show resources that are stale and have this header set, the optional cache request never completes. This means we're also never going to try to actually get a fresh tile and just never show this tile anymore.

This commit fixes this by responding with a Not Found error when the resource is unusable (= stale and has must-revalidate set). Since we actually still have the data (but can't use it due to caching rules), we're responding with the data as well. To avoid a second cache hit, tile_loader_impl.hpp now passes on the data from the Optional to the Required request so that it can be reused when we get a 304 Not Modified response from the server.
2017-09-25 10:47:20 +02:00
Konstantin Käfer
f0a7c45064 [core] finish must-revalidate support 2017-08-08 12:40:38 +02:00
Thiago Marcos P. Santos
ea34cb5725 [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.
2017-06-26 16:32:21 +03:00
Jesse Bounds
e1546644b5 [core] Cache file source base URL and access token
This caches the base URL and access token values when they are set
so that they can still be retrieved even when the thread is paused.
2017-03-01 08:25:44 -08:00
Konstantin Käfer
f0ec9fb74b [test] add unit test for DefaultFileSource::setResourceTransform() 2017-02-20 14:36:27 +01:00
Konstantin Käfer
3f3fc7b772 [test] add .test.cpp suffix to test case files 2016-09-28 16:34:22 +02:00