Commit Graph

227 Commits

Author SHA1 Message Date
Mikhail Pozdnyakov
6899337f86 [core] Add Map.Issue15342 unit test
The newly added test checks the fix for constant repaint,
caused by `RenderSource::hasFadingTiles()` returning `true` all the time.
2019-09-12 00:40:08 +03:00
Alexander Shalamov
92b3386dec [core] Add unit test to verify that Offline usage tag is not set
New unit test checks that Offline usage flag is not set for invalidated
offline region resource requests.
2019-09-11 10:47:55 +03:00
Konstantin Käfer
c7be3d52a7 Always call onSourceLoaded observers (#15548)
* [core] add sources to source collection before triggering load

* [test] add testcase for #15514

* [core] also call onSourceLoaded observers when no network request was necessary
2019-09-03 17:02:23 -07:00
Bruno de Oliveira Abinader
544aabd020 [core] Add requiredTileCount to OfflineRegionStatus 2019-08-29 18:22:59 +03:00
Mikhail Pozdnyakov
f84e46ad26 [core] Mark offline region resources in batches 2019-08-29 17:28:51 +03:00
Jason Wray
5722136680 [core] Disable flaky OfflineDatabase.MaximumAmbientCacheSize test 2019-08-07 10:42:35 -07:00
Thiago Marcos P. Santos
24df7fe5f5 [core] Add storage unit tests for MapboxTileLimitExceeded 2019-06-19 17:19:10 +03:00
Thiago Marcos P. Santos
1977934bdb [tests] Add unit tests for cache size 2019-06-18 16:26:51 +03:00
Thiago Marcos P. Santos
68e3cbacbc [core] Add method for setting a maximum size for the ambient cache
- Removed this parameter from the constructor, now that we
  have a method to set it.
- Add the method and enforce the limits if the ambient cache exceeds the
  size.
2019-06-18 16:26:51 +03:00
Thiago Marcos P. Santos
78eeffe171 [core] Clear/Invalidate should also work on non-tile resources
These methods were only affecting tiles, but they should really
work on every resource like style, glyphs, etc.
2019-06-18 16:26:51 +03:00
Thiago Marcos P. Santos
59e7b9a878 [core] Rename resetCache to resetDatabase
Avoid confusion about what is being reset. In this case, the whole
database and not only the ambient cache.
2019-06-18 16:26:51 +03:00
Thiago Marcos P. Santos
9beb740fb7 [tests] Follow-up of previews PR, these tests need write permission 2019-06-18 16:26:51 +03:00
Thiago Marcos P. Santos
9815fc0d16 [tests] Improve unit test for deleting offline region and concurrent use
Test if the physical size of the database will also reduce.

Clear the cache while adding resource on another connection.
2019-06-13 22:28:16 +03:00
Thiago Marcos P. Santos
4b1f9a3b3f [tests] Add unit test for clearing the ambient cache 2019-06-13 22:28:16 +03:00
Thiago Marcos P. Santos
33ee7e23de [core] Remove priority from the constructor
Make the constructor less verbose and set good defaults.
2019-05-28 16:30:49 +03:00
Thiago Marcos P. Santos
cc26ef17d5 [core] Introduce usage tag for resources
Make the distinction if a resource is being requested for offline
usage or if it will be used immediately.

Fixes #14746
2019-05-28 16:30:49 +03:00
Łukasz Paczos
46ef2d86d2 [core] invoke optional resource path change completion listener 2019-05-24 15:03:55 +02:00
Thiago Marcos P. Santos
19f5686eb2 [tests] Add unit tests for offline data invalidation 2019-05-21 01:04:01 +03:00
Sudarsana Babu Nagineni
a31734ddad [test] Add unit test for clearCache API 2019-04-29 17:09:58 +03:00
Konstantin Käfer
3ceabcd3ec [core] clang-tidy fixes 2019-04-05 11:49:17 +02:00
Łukasz Paczos
3f7b70fdb0 [core] expose an option to change the db file path in runtime 2019-03-13 18:28:04 +01:00
Chris Loer
b7e2b11a75 [core] Support for excluding ideographic glyphs from offline downloads. 2018-12-21 15:13:48 -08:00
Konstantin Käfer
1d8235f5b8 [build] rework platform/default directory and add -files.txt for vendored libs 2018-12-14 11:03:03 +01:00
Minh Nguyễn
7d5be980e2 [core] Fixed {prefix} evaluation
This appears to have been an attempt to use the std::string fill constructor, but it ended up creating a one-character-long string and attempting to overwrite the null terminator.
2018-11-21 09:54:05 -08:00
Huyen Chau Nguyen
8d0b06d5dd [core] add test about number of maximum concurrent requests 2018-11-15 12:19:48 -08:00
Huyen Chau Nguyen
9a606caf0b [core] define number of concurrent downloads in online file source variable 2018-11-15 12:19:48 -08:00
Thiago Marcos P. Santos
01d9005c3b [test] Add test for when requesting the same resource many times
This test would have prevented the crash fixed by the previous patch.
2018-11-13 23:26:34 +02:00
Huyen Chau Nguyen
fa78bcadfd [core] add tests for handling requests with different priorities
- ensure that low priority requests are handled last
- add option to set the number of maximum concurrent requests for tests
- some style fixups
2018-10-23 12:47:10 +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
153acd981b [core] Always request 1x and @2x sprite images for portability
When creating a offline region, we've previously only requested the sprite image for the specified resolution. This lead to offline packs not being usable on devices that have a different pixel ratio. We're now requesting both 1x and 2x sprites. Some devices use even higher or fractional pixel ratios. However, we only ever use 1x and 2x sprite images in our requests.
2018-09-24 11:35:44 +02:00
Konstantin Käfer
4a3c4edb59 [android] add support for gnustl 2018-09-11 11:43:54 +02:00
Asheem Mamoowala
d4f4136414 Enforce Offline tile limit when merging sideloaded databases 2018-08-28 07:14:54 -07:00
Asheem Mamoowala
eb72fe580b Require minimum side-loaded database user_version=6 2018-08-28 07:14:54 -07:00
Asheem Mamoowala
fcab3a81cd Add unit tests and fixtures for OfflineDatabase::mergeDatabase 2018-08-28 07:14:54 -07:00
Ivo van Dongen
fae099933b [core] offline region definition - add support for arbitrary geometries 2018-08-20 22:49:01 +03:00
Konstantin Käfer
084c28f0bb [core] recreate offline database when it is deleted out from under our feet 2018-08-14 17:03:46 -07:00
Konstantin Käfer
6e06e55b95 WIP: use expected<T, E> for passing on errors 2018-08-14 17:03:46 -07:00
Konstantin Käfer
89515de769 [test] add test for pending offline download when the disk is full 2018-08-14 17:03:46 -07:00
Konstantin Käfer
fa7b70945f [core] harden OfflineDatabase 2018-08-14 17:03:46 -07:00
John Firebaugh
b500577bfa [android, linux] Upgrade to SQLite 3.24.0, compiled to minimize binary size 2018-08-10 08:49:18 -07:00
Bruno de Oliveira Abinader
20d21cb7bc Revert "[core] Replace Boost.Spirit with std::regex in CacheControl::parse()"
This reverts commit 990b3b11b9.
2018-08-08 19:03:55 +03:00
Bruno de Oliveira Abinader
990b3b11b9 [core] Replace Boost.Spirit with std::regex in CacheControl::parse() 2018-08-08 14:14:34 +03:00
Zsolt Bölöny
bc6094eb55 [core] Fix GCC8's new -Wcatch-value warnings
Polymorphic types shouldn't be caught by value, as the warning message says. Catch them by constant reference instead.
2018-06-25 10:07:04 -07:00
Konstantin Käfer
0ecdbebb09 [core] consolidate database opening workflow
Before this change, we've tried to open the database in read/write, but not create mode. In situations where the database didn't exist yet, this logged an error to the console, and we proceeded to opening it again in read/write/create mode, which actually created the file. The reason we did this is so that we could detect really old caching databases from January 2016 in case a developer upgraded from an older SDK (iOS v3.1 and earlier, Android v3.2 and earlier) that didn't have https://github.com/mapbox/mapbox-gl-native/pull/3715 yet.

However, these error messages, while innocent, look scary in the console and some users suspect that it's a bug. This change opens the file directly in read/write/create mode, omitting the first failed attempt. To handle old cache databases, we're now deleting the `http_cache` table, which was the only table in those old databases, and create the new schema, rather than deleting the entire file and recreating the Database object. In most scenarios, this will lead to one fewer opening attempt, while the database migration will continue to work for the few users who upgrade all the way from a January 2016 SDK.

Additionally, this fixes a mismatch between the Qt and non-Qt implementation: Qt doesn't support opening a file in read/write mode without the create flag. This means that we've seen a different control flow on Qt compared to the non-Qt implementation when opening a database.
2018-06-12 17:41:16 +02:00
Konstantin Käfer
4477dd4119 [core] support moving Database object during a Transaction 2018-06-12 17:41:16 +02:00
Konstantin Käfer
a50493ea51 [test] verify log messages of OfflineDatabase tests 2018-06-12 17:41:16 +02:00
Konstantin Käfer
1fbf3f2d48 [test] standardize on database file name and move I/O functions to util 2018-06-12 17:41:16 +02:00
Konstantin Käfer
31953c4c83 [test] pull out using namespace mbgl to reduce verbosity 2018-06-12 17:41:16 +02:00
Ivo van Dongen
d928908ec8 [core] offline database - batch region resource inserts 2018-06-04 12:09:32 +03:00
John Firebaugh
a1195f6a9d Avoid exceptions for flow control during database creation
Unfortuntely, it's difficult to avoid all exceptions, because sqlite3_open_v2 does not reliably return SQLITE_NOTADB if the file is not a database. However, this should avoid cases where developers misinterpret the SQLITE_CANTOPEN exception as a crash, which is the common case.
2018-05-09 07:32:16 -07:00