summaryrefslogtreecommitdiff
path: root/platform/default/default_file_source.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [core] make forcing cache/network only more explicitKonstantin Käfer2017-10-121-28/+22
| | | | | | 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.
* [core] fix loading of stale must-revalidate resourcesKonstantin Käfer2017-09-251-9/+15
| | | | | | 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.
* [test] add ability to take the OnlineFileSource offlineKonstantin Käfer2017-09-221-0/+8
| | | | This functionality is used for testing to ensure correct offline behavior when connectivity is missing.
* [core] initialize OfflineDatabase asynchronously in DefaultFileSourceKonstantin Käfer2017-08-281-13/+18
| | | | Sometimes, initialization can take hundreds of milliseconds, in particular when the database doesn't exist yet, or when the app/device is doing a lot of I/O already. Instead of synchronously initializing the OfflineDatabase objects, we're now asynchronously initializing the object through a self-sent message that by virtue of being the first message for this actor guarantees that the object is there when it's needed by other member functions.
* [core] finish must-revalidate supportKonstantin Käfer2017-08-081-1/+11
|
* [core] Use the ResourceTransform instead of callbacksThiago Marcos P. Santos2017-06-261-12/+4
| | | | | Based on the actor model, can be considered safer to use since we don't need to worry about object lifetime anymore.
* [core] Rename ThreadedObject to ThreadThiago Marcos P. Santos2017-06-211-2/+2
| | | | | Now that the old Thread class is gone, we can give ThreadedObject a better name.
* [core] Convert DefaultFileSource to ThreadedObjectThiago Marcos P. Santos2017-06-211-34/+29
| | | | Fixes #6426
* [core] default file source - ensure thread safety for cached valuesIvo van Dongen2017-05-271-4/+14
|
* [core] default file source - ensure thread safety for local file and asset ↵Ivo van Dongen2017-05-271-38/+46
| | | | requests
* [core] allow filesource url transform resetIvo van Dongen2017-05-121-6/+10
|
* [android] use AAssetManager instead of libzipKonstantin Käfer2017-04-241-1/+7
|
* [core] Cache file source base URL and access tokenJesse Bounds2017-03-011-4/+6
| | | | | 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.
* [core] Add a pause/resume API to the DefaultFileSourceThiago Marcos P. Santos2017-02-251-0/+8
| | | | | It will halt the networking thread completely. Expired and error'ed tiles won't get re-requested until resume() is called again.
* [core] add ability to transform URLs before they're requested from the InternetKonstantin Käfer2017-02-201-0/+13
|
* [core] remove trailing whitespace, add trailing newlines, add space after //Konstantin Käfer2017-01-271-5/+5
|
* [build] move logging to utilKonstantin Käfer2016-11-221-1/+1
|
* [core] LocalFileSource implementation and testsIvo van Dongen2016-09-301-1/+5
|
* [core] allow offline region metadata to be updated (#6338)Molly Lloyd2016-09-201-0/+16
|
* [core] [android] - public api configurable base endpoint (#6309)Tobrun2016-09-151-0/+16
| | | add runloop to test
* [core] Rework invokeWithCallback so that the callback is lastJohn Firebaugh2016-09-081-1/+1
|
* [core] Simplify Thread::invokeSync (#6128)John Firebaugh2016-08-241-1/+1
|
* [core] allow creating optional requestsKonstantin Käfer2016-05-181-11/+25
| | | | | | Introduces "optional" requests. These should be fulfilled by the FileSource only there's a low-cost/easy way to obtain the data (e.g. from a local cache). If the data for an optional request cannot be found, it *must* return a Response object with a NotFound error. Traditional "required" requests still work the same way, with one change: If you set any prior* field in the Resource (i.e. priorModified, priorEtag, or priorExpires), the DefaultFileSource assumes that you already have the cache value and will not consult the cache before performing the request. If a prior cache lookup didn't turn up any data, and you therefore don't have an Etag or Modified value, you can still skip the cache by setting priorExpires. This will of course always result in a non-conditional HTTP request.
* [core] remove indirection via Task object in DefaultFileSourceKonstantin Käfer2016-05-121-25/+16
|
* [core] Clean up ThreadContext vestigesJohn Firebaugh2016-04-151-1/+1
|
* Merge branch 'release-ios-3.2.0-android-4.0.0'John Firebaugh2016-03-301-0/+1
|\
| * [core] Stop any OfflineDownload before deleting a regionJohn Firebaugh2016-03-211-0/+1
| | | | | | | | No progress events should be processed after deleting a region.
* | [core] Unify FileRequest and WorkRequestJohn Firebaugh2016-03-241-8/+8
|/
* [core] Make OnlineFileSource respect the NetworkStatusThiago Marcos P. Santos2016-03-081-7/+4
| | | | | The user can now force the Offline mode and set it back to Online, triggering the requests waiting for network connection.
* [core] Remove goOffline() from DefaultFileSourceThiago Marcos P. Santos2016-03-081-10/+2
| | | | Use the newly added NetworkStatus::Set().
* [core] Limit total number of offline Mapbox tilesJohn Firebaugh2016-02-241-0/+8
|
* [core] Eliminate maximumCacheEntrySizeJohn Firebaugh2016-02-101-5/+4
| | | | Instead, the eviction policy accounts for the actual size needed for an incoming put.
* [core] Implement an eviction policy for OfflineDatabaseJohn Firebaugh2016-02-101-25/+8
| | | | | | | | | | | | | When inserting an cached resource, or removing a region, remove least-recently used resources and tiles, not used by offline regions, until the used database size, as calculated by multiplying the number of in-use pages by the page size, is less than the maximum cache size minus 5 times the page size. In addition, OfflineDatabase may be configured to ignore cache puts of individual resources larger than a certain size. This policy is similar but not identical to the former SQLiteCache policy: * It accounts for offline, by exempting resources required by offline regions from eviction. * It must delete from two tables (resources and tiles), rather than one. Currently the strategy is naive: evict 50 rows at a time from each table. * It makes maximumCacheSize and maximumCacheEntrySize completely independent. The SQLiteCache implementation evicted when `usedSize > maximumCacheSize - 2 * maximumCacheEntrySize`. This evicts when `usedSize > maximumCacheSize - 5 * pageSize`. * It uses a non-unlimited default value for maximumCacheSize: 50 MB. We should have always had a limit in place; "a cache without an eviction policy is a resource leak".
* [core] Make {Default,Online}FileSource::Impl more similarJohn Firebaugh2016-02-101-16/+16
|
* [core] Interface and implementation for offlineJohn Firebaugh2016-02-101-1/+97
|
* [core] Reimplement existing caching within an offline-capable database schemaJohn Firebaugh2016-02-101-47/+89
|
* [core] Moving caching logic to DefaultFileSourceJohn Firebaugh2016-02-101-3/+37
| | | | This results in OnlineFileSource containing precisely the logic we want for reuse by OfflineFileSource, and no more.
* [core] move SharedSQLiteCache::get to SQLiteCache::getSharedKonstantin Käfer2016-01-151-1/+1
|
* [core] Eliminate platform::assetRoot()John Firebaugh2016-01-131-2/+2
| | | | I regenerated assets.zip so that all file paths have an `assets/` prefix, as the Android AssetFileSource implementation asserts, and removed `TEST_DATA` from the paths.
* [core] Simplify asset:// implementationJohn Firebaugh2016-01-131-4/+24
| | | | | | | | * Move asset:// URL handling to DefaultFileSource. * AssetFileSource implements FileSource interface and follows familiar implementation patterns. * Move default implementation to platform/default, zip implementation to platform/android. * Don't bother with modified / expires / etag -- assets are not cached so it doesn't matter. * Don't bother with interleaving individual IO calls on the implementation thread. That adds a lot of complexity for very little benefit.
* [core] Privatize SQLiteCacheJohn Firebaugh2016-01-081-4/+15
|
* [tests] Test with OnlineFileSourceJohn Firebaugh2015-12-231-2/+1
| | | | | When we introduce OfflineFileSource, the behavior of existing tests should not change.
* [core] Move OnlineFileSource to platformJohn Firebaugh2015-12-221-0/+34
Preparation for OfflineFileSource which depends on SQLite