Commit Graph

727 Commits

Author SHA1 Message Date
Alexander Shalamov
f076a1fe39 [core] Use util::readFile for Local and Asset file sources
Use exception free util::readFile instead of util::read_file for
LocalFileSource and AssetFileSource implementations.
2018-12-17 11:37:56 +02: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
Mikhail Pozdnyakov
ebd87a5442 [core, android, darwin] Move layer factories to separate files 2018-12-10 18:20:32 +02:00
Mikhail Pozdnyakov
92352de87d [core] layermanager folder
Move `LayerManager` and `LayerFactory` abstract classes to a dedicated folder.
2018-11-30 19:09:17 +02:00
Mikhail Pozdnyakov
ad03e42b28 [core] LayerManager can disable annotations
At the moment, the annotations implementation in the `mapbox-gl-native`
core is creating concrete layer instances apart from `LayerManager/LayerFactory`
code path.

So, annotations must be disabled if the `LayerManager` implementation does
not provide line, fill or symbol layers (those, used by the annotations).

Note: in future, annotations implementation will be moved from the core to the
platform SDK level(see https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation)
and `LayerManager` won't need to disable it.
2018-11-28 17:18:38 +02:00
Mikhail Pozdnyakov
361982fef8 [core][Android][Darwin] LayerManager creates RenderLayer instances
`LayerManager` is now responsible for `RenderLayer` instances creation,
so that there is a single entry point for creating of objects, which
correspond to a certain layer type.

The `LayerType type` field is dropped from `Layer::Impl`.
2018-11-27 18:10:21 +02:00
Chris Loer
afdc243042 [core] Expose "local ideograph font family" in MapSnapshotter. 2018-11-24 09:57:32 -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
Mikhail Pozdnyakov
33818233cf [core][android] Introduce mbgl::style::LayerTypeInfo
The `LayerTypeInfo` contains static meta data about certain layer type.

Each layer module should have a single immutable `LayerTypeInfo` instance
for the represented layer type. Both `LayerImpl` and `LayerFactory` from the
module always refer to the same `LayerTypeInfo` instance, so address of this
instance can be used as a layer module Id during the process life time.
2018-11-15 18:32:31 +02:00
Bruno de Oliveira Abinader
db2e1b2e5f [core] Add RendererState::{pixelForLatLng,latLngForPixel} 2018-11-14 12:22:22 +02:00
Mikhail Pozdnyakov
5a70f2b150 noexcept specifier for layer factory methods 2018-11-07 16:34:20 +02:00
Mikhail Pozdnyakov
ffdeef3a26 Refer corresponding LayerFactory instance from the Layer::Impl 2018-11-07 16:34:20 +02:00
Thiago Marcos P. Santos
7ff85374a7 [build] Remove #pragma diagnostic for boost
Boost is now included as a system header and the compiler
should ignore it when issuing warnings.
2018-11-01 16:29:37 +02:00
Bruno de Oliveira Abinader
a7b3f40f44 [build] GCC 7+ complains about -Wimplicit-fallthrough in utf.cpp 2018-10-25 16:23:40 +03:00
Bruno de Oliveira Abinader
55710cbb67 [core] Added RendererState::has{Image,Layer,Source} 2018-10-25 16:23:40 +03: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
40693e00a8 [core] add logic of high and low priority requests to OnlineFileSource
- only process low priority requests (=offline requests) if there are no outstanding regular requests
- favour regular requests over low priority ones
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
282c71e8e9 [core] unify UTF-8/16 conversion to <boost/locale/encoding_utf.hpp> 2018-10-23 12:23:40 +02:00
Bruno de Oliveira Abinader
ea51b11dcc [core] Introduce mbgl::RendererState 2018-10-19 12:05:16 +02:00
Bruno de Oliveira Abinader
b94be6e68f [core] Add TransformState::getCameraOptions() 2018-10-19 12:05:16 +02:00
Chris Loer
f510b577aa [core] Promote DefaultFileSource::put to general use. 2018-10-17 12:53:24 -07:00
Chris Loer
fc11d2e872 [core, test] Add BiDi unit test
- Port of arabic.test.js from mapbox-gl-rtl-text
- Modify BiDi::getLine to remove trailing nulls in the event UBIDI_REMOVE_BIDI_CONTROLS causes the string to shorten.
- Patch vendored ICU to avoid undefined undefined bit shifting behavior (triggered sanitizer failure)
2018-10-15 13:15:46 -07:00
Chris Loer
bc71825774 [core] Bidi support for styled text.
Remove use of QString from non-ICU Qt stub bidi implementation since we weren't making use of it.
2018-10-15 13:15:46 -07:00
Konstantin Käfer
4004a85a79 [android] explicitly set temp directory for SQLite3 2018-09-26 13:47:28 +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
Asheem Mamoowala
d5f0e4b41e Use named function instead of lambda for SQlite3 log config 2018-09-21 12:13:26 +02:00
Fabian Guerra Soto
a938c3ef68 [ios, macos] Offline regions merge. (#12791)
* [ios, macos] Add offline regions merge.

* [ios, macos] Update changelogs.

* [ios, macos] Fix refreshing the offline packs after new content is added.

* [ios, macos] Update MGLOfflineStorage's add contents of file documentation.

* [ios, macos] Add MGLOfflineStorage test cases for adding file contents.

* [ios, macos] Add offline merge test database.

* [ios, macos] Add packs parameter to MGLBatchedOfflinePackAdditionCompletionHandler.

* [core] Fix a query mege duplication.

* [ios, macos] Remove unnecessary pack iteration.

* [ios, macos] Fix packs update KVO notifications.

* [ios, macos] Add localization strings.

* [core] Fix query readability.

* [ios, macos] Fix MGLOfflineStorageTest, cleanup the cache database after the test.

* [ios, macos] Fix offline packs, updating triggers a crash.
2018-09-17 15:31:43 -07:00
Konstantin Käfer
071129bf61 [linux,qt] Remove remainder of WebP support 2018-09-13 13:27:44 +02:00
Konstantin Käfer
30e570aae7 [core] add polyfill for codecvt for STLs that don't have it yet 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
Asheem Mamoowala
065f5ca87e [core] Add DefaultFileSource::mergeRegions API and CLI support in the mbgl-offline tool. 2018-08-28 07:14:54 -07:00
Asheem Mamoowala
48381efa11 SQL Statements to merge an attached database with name 'side' into the main database.
Co-authored-by: kkaefer <mail@kkaefer.com>
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
fa7b70945f [core] harden OfflineDatabase 2018-08-14 17:03:46 -07:00
Vladimir Kondrashov
9ecb0997ef [core] Fix out of range exception for string compare 2018-08-14 11:16:10 -07:00
Thiago Marcos P. Santos
f3ebdaebaf [windows] Fix build on Windows
Include what you use.
2018-08-14 12:09:09 +03:00
Konstantin Käfer
561e55eb6c [core] make the offline DB schema a regular include file 2018-07-16 18:24:51 +02:00
tobrun
99f9787cc4 [core] - add LatLng for screencoordinate to mapsnapshotter 2018-07-05 18:50:21 +02:00
Anand Thakker
cfd436c287 [core] Avoid blocking in Thread<Object> constructor (#12151)
* Introduce AspiringActor, EstablishedActor

This pair of objects represents the two-phase (parent-thread /
child-thread) construction that's needed to support constructing
Thread<Object> without blocking until the child thread is up and
running.

An `AspiringActor<O>` is responsible for:
 - ownership of the actor's `Mailbox`
 - allocating the memory for (but *not* constructing) the target object `O`

Using these two pieces--the mailbox and a stable address for `O`--an
`AspiringActor<O>` can accept messages for the target object, or provide
`ActorRef<O>`s that do so, before the object has actually been
constructed by the corresponding `EstablishedActor<O>`.  (Such messages
are queued in the mailbox until after the object is constructed.)

This allows for an `AspiringActor<O>` to be created and safely used by a
thread other than the one on which the target object will (eventually)
live.

An `EstablishedActor<O>` is responsible for managing the lifetime of the
target object `O` and the open/closed state of the parent's `mailbox`.

The `O` object's lifetime is contained by that of its owning
`EstablishedActor<O>`: the `EstablishedActor` constructor executes the
`O` constructor via "placement new", constructing it at the address
provided by the parent `AspiringActor`, and the `~EstablishedActor`
destructor similarly executes the `~O` destructor (after closing the
mailbox). `EstablishedActor` should therefore live entirely on the
thread intended to own `O`.

* Remove Actor#{invoke,ask}
2018-07-03 17:17:39 -04:00
Chris Loer
35256c6e5b [core] Default "collator" implementation
- Based on nunicode
 - Not locale-aware
 - Used by linux and Qt builds
2018-07-03 10:03:05 -07:00
Chris Loer
251f5e605f [core, vendor] Create vendored nunicode 1.8.
- Version bump to 1.8 necessary for "unaccent" functionality
- Qt now depends on nunicode, ruling out use of precompiled binaries
2018-07-03 10:03:05 -07: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
Lloyd Sheng
eb70b89849 [core] Measuring tiles requesting/parsing time using logging (#12152)
* Tile timing

* Refactor logging code

* Keep the scope of `messageStream` constrained

* Make log message more clear

* Fix crash issue if onlineResponse.data is null
2018-06-21 11:24:14 +08: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
79394ee47d [core] remove unused flags from SQLite header 2018-06-12 17:41:16 +02:00