Commit Graph

171 Commits

Author SHA1 Message Date
Anand Thakker
b8654b3b04 [core] Move SourceType to the 'style' namespace 2017-10-16 16:32:53 -07: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
Asheem Mamoowala
50fd917510 Fast tileCount with help from @mapbox/sphericalmercator module 2017-09-08 17:38:42 -07:00
Thiago Marcos P. Santos
bd15e273dc [tests] Enforce the schema downgrade behavior
Which is, delete and recreate the database.
2017-08-22 12:46:38 +03:00
Konstantin Käfer
f0a7c45064 [core] finish must-revalidate support 2017-08-08 12:40:38 +02:00
Thiago Marcos P. Santos
544d875445 [tests] Add test to enforce database not found behavior
Make sure all the implementations, currently Qt and Default, throw
an exception with error code CANTOPEN when opening a database that
doesn't exist without the CREATE flag.
2017-07-17 16:47:29 +03: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
Thiago Marcos P. Santos
7e8bdadb91 [core] Rename ThreadedObject to Thread
Now that the old Thread class is gone, we can give ThreadedObject
a better name.
2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
495f06ac4d [core] Convert AssetFileSource to ThreadedObject 2017-06-21 14:30:09 +03:00
Asheem Mamoowala
aa6647e910 [core] Offline support for Image Sources 2017-06-01 15:38:01 -07:00
Bruno de Oliveira Abinader
c6eb4afe0e [tidy] modernize-deprecated-headers 2017-05-12 18:07:36 +03:00
Konstantin Käfer
197f0ca6b4 [android] use AAssetManager instead of libzip 2017-04-24 10:42:10 +02: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
Thiago Marcos P. Santos
318690645e [test] Added unit test for style request failures 2017-02-07 12:17:40 +01:00
Konstantin Käfer
62ea1f2185 [core] remove trailing whitespace, add trailing newlines, add space after // 2017-01-27 11:44:16 +01:00
Bruno de Oliveira Abinader
88b7fc3929 [Qt] Implement mapbox::sqlite::{Database,Statement} using QtSql 2017-01-23 19:06:53 +02:00
Bruno de Oliveira Abinader
80d72123df [core] Move lastInsertRowId/changes to sqlite::Statement 2017-01-23 19:06:53 +02:00
Ivo van Dongen
c810d16f0d [android][build] core tests - initial setup for rendering tests 2016-11-27 18:50:24 +02:00
Ivo van Dongen
d2c9750b6d [core] fix up online file source test so it compiles on android 2016-11-27 18:50:24 +02:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
Tore Halset
a4b79ac289 [core] Optimize OfflineDownload::ensureResource (#6707)
Add `OfflineDatabase::hasRegionResource`, for use when the actual contents are not needed by the caller, avoiding IO and decompression costs.
2016-10-17 09:27:07 -07:00
Konstantin Käfer
b470a65582 [build] add back -Werror 2016-09-30 17:01:05 +02:00
Ivo van Dongen
1bf12e20a6 [core] LocalFileSource implementation and tests 2016-09-30 14:57:26 +02:00
Konstantin Käfer
3f3fc7b772 [test] add .test.cpp suffix to test case files 2016-09-28 16:34:22 +02:00
John Firebaugh
570bafcfec [core] Don't allow OfflineDownload to flood the request queue 2016-09-26 14:55:49 -07:00
Molly Lloyd
598f7c6ad5 [core] allow offline region metadata to be updated (#6338) 2016-09-20 17:43:00 +02:00
Tobrun
9ef65440b6 [core] [android] - public api configurable base endpoint (#6309)
add runloop to test
2016-09-15 22:01:09 -07:00
Jason Wray
9237ad3c58 [tests] Add v3 & v4 database migration tests 2016-09-14 15:48:53 -04:00
Jason Wray
4daff7f2f8 [core] Revert SQLite WAL journaling 2016-09-14 15:45:47 -04:00
Ivo van Dongen
290bd07a92 [core] OnlineFileSource - rate limit 2016-09-13 14:21:37 +02:00
Jason Wray
74f094faab [core] Update SQLite schema with WAL journal mode and normal sync
Offers 2×-4× performance, depending on device vintage.
2016-08-23 13:26:02 -04:00
Konstantin Käfer
18176605f6 [core] support "scheme": "tms" in TileJSON files 2016-08-16 11:04:30 +02:00
Minh Nguyễn
08d0a9a0e2 Quadkey tokens in tile URL templates, limited WMS support (#5628)
* [core] Quadkey tokens in tile URL templates

Fixes #5485.

* [core] WMS tokens in tile URL templates

Fixes #822.

* [macos] Added WMS debug style

Added a style to the macosapp resource bundle that can be used to test WMS support. To use it, zoom in to somewhere in New Jersey, then go to View ‣ Custom Style and enter “wms.json”.
2016-07-12 10:57:18 -07:00
John Firebaugh
b8326870e1 [core] Increment completedTileCount when appropriate (#5475) 2016-06-24 15:28:10 -07:00
John Firebaugh
6eab895bc0 [core] Use Range<uint8_t> instead of full Tileset where possible 2016-06-14 11:25:45 -07:00
Bruno de Oliveira Abinader
9142c447e8 [tidy] Check llvm-namespace-comment
Ref: http://clang.llvm.org/extra/clang-tidy/checks/llvm-namespace-comment.html
2016-06-13 23:32:05 +03:00
Konstantin Käfer
2bdecdf9f9 [core] fix pedantic warning messages 2016-06-13 11:16:19 +02:00
Thiago Marcos P. Santos
40211abd9a [test] Rename Stress test to Load
Too slow to run on valgrind.
2016-06-09 19:56:35 +03:00
John Firebaugh
c902f9098b [core] Rationalize naming for style-related code 2016-06-02 14:51:39 -07:00
Konstantin Käfer
8ee222c45e [core] allow creating optional requests
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.
2016-05-18 12:40:22 +02:00
Konstantin Käfer
cd65a43855 [core] move from microsecond precision timestamp to integer second precision 2016-05-13 17:24:22 +02:00
Konstantin Käfer
7332ae0073 [core] retain tiles differently and remove old TileID class 2016-05-10 14:50:56 +02:00
John Firebaugh
b39f22e6b6 [core] Refactor getRegionCompletedStatus; add completedTileCount; add tests 2016-04-27 13:41:29 -07:00
John Firebaugh
e916cc811c [tests] Rationalize test fixtures (#4834)
Place them in a directory corresponding to the test .cpp file name.
2016-04-25 14:51:27 -07:00
John Firebaugh
5939dd5b41 [core] Use the proper type for font stacks 2016-04-22 15:53:18 -07:00
John Firebaugh
6e78eabfff [core] Clean up ThreadContext vestiges 2016-04-15 09:56:18 -07:00
John Firebaugh
7de9e196d7 [tests] Rationalize storage tests
Properly divide Storage tests into DefaultFileSource, OnlineFileSource, and HTTPFileSource tests.
2016-04-14 14:18:19 -07:00
John Firebaugh
18d8e80f52 [core] Demote "Unable to make space for entry" message from Warning to Debug (#4708) 2016-04-14 13:43:24 -07:00