Commit Graph

698 Commits

Author SHA1 Message Date
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
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
1a0f8e652f [core] send all SQLite log messages to the Info bucket and add error codes 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
Ivo van Dongen
4146d8d9be [core] offline database - move transaction scope to public api level 2018-06-04 12:09:32 +03:00
Konstantin Käfer
500cf3864e [linux] load cURL dynamically for wider compatibility 2018-06-04 10:43:21 +02:00
tobrun
930d0bc17c [core] [android] - optional map snapshotter camera position 2018-05-31 07:23:06 +02:00
tobrun
7193a43729 [core] [android] - add style json setter/getter to map snapshotter 2018-05-30 20:23:57 +02:00
Tobrun
671fe37b1e Style JSON configuration on map snapshotter (#11976)
* [core, android, darwin] - add style JSON configuration on MapSnapshotter
2018-05-23 10:52:22 +02: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
Jason Wray
c067865e7b [ios, macos] Update minimum deployment versions to iOS 9, macOS 10.11 (#11776)
* [ios] Remove iOS 8 conditionals

* [ios, macos] Bump pod deployment targets

* [ios, macos] Add changelog entries

* [ios, macos] Update docs

* Remove unnecessary selector-based version checks

* Update SQLite note

* [ios, macos] Replace lightweight generics macros with direct use
   Lightweight generics for Foundation collections are available everywhere with the bump to iOS 9 and macOS 10.11.

* Update deprecated macOS method
2018-04-27 12:25:49 -04:00
Asheem Mamoowala
4344812ef5 [core] Streaming TileCover for polygonal regions (#11267)
A per-tile streaming algorithm for tile cover on points, lines, and polygons. Works for individual zoom levels, and not zoom ranges.
2018-04-26 07:43:38 -07:00
Fabian Guerra
e08b6fe87f Merge branch 'release-boba' into master
# Conflicts:
#	circle.yml
#	include/mbgl/style/expression/let.hpp
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java
#	platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
#	platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java
#	platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
#	platform/android/gradle/dependencies.gradle
#	platform/android/src/example_custom_layer.cpp
#	platform/android/src/geojson/point.cpp
#	platform/darwin/src/NSPredicate+MGLAdditions.mm
#	platform/darwin/test/MGLExpressionTests.mm
#	platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec
#	platform/ios/Mapbox-iOS-SDK-symbols.podspec
#	platform/ios/Mapbox-iOS-SDK.podspec
#	platform/ios/app/MBXViewController.m
#	src/mbgl/renderer/layers/render_custom_layer.cpp
#	src/mbgl/style/conversion/filter.cpp
#	src/mbgl/style/expression/interpolate.cpp
#	src/mbgl/style/expression/value.cpp
#	test/style/filter.test.cpp
2018-04-23 10:44:02 -04:00
Konstantin Käfer
136e536159 [core, qt] move self-resetting Statement/Query object to shared header 2018-03-02 14:26:25 +01:00
Konstantin Käfer
5ca38bbde9 [core] refactor SQLite error/status codes 2018-03-02 14:26:25 +01:00
Konstantin Käfer
b0a840e44f [core] improve SQLite error logging 2018-03-02 14:26:25 +01:00
Bruno de Oliveira Abinader
df92af27d9 [core] Add space in OfflineDatabase::updateMetadata SQL query 2018-02-27 16:28:36 +02:00
Jordan Kiley
9459cf6a91 [ios, macos] Mark deprecated methods as unavailable (#11205)
Fixes #10735
2018-02-16 16:20:08 -08:00
Konstantin Käfer
78f8fd88b4 [core] factor out RunLoop::wake() 2018-02-06 18:49:06 +01:00
Konstantin Käfer
c148a7a061 [core] align implementations of local and asset file source 2018-01-25 13:45:47 -08:00
Molly Lloyd
f3294200c6 [core] add raster-dem source type and hillshade layer type (#10642) 2018-01-23 10:49:23 -08:00
Thiago Marcos P. Santos
035418336e [windows][core] Define S_ISDIR when not defined 2018-01-08 22:58:20 +02:00
Chris Loer
b4c781aef7 [core, macos, ios] Unit tests for LocalGlyphRasterizer
Core test uses stubbed "glyph.pbf" without Chinese glyphs
Darwin test relies on locally available "PingFang" font.
Android test relies on locally available "Droid" font. 'expected.png' is NOT correct b/c I haven't figured out how to run unit tests on Android yet.
2017-12-11 10:43:00 -08:00
Chris Loer
cb380064bb [ios,macos] Darwin implementation of a CoreText-based LocalGlyphRasterizer.
- Changing font weight does not currently appear to be working.
 - Glyph metric extraction code not working; currently unused.
2017-12-11 10:43:00 -08:00
Chris Loer
1661af1cb4 [core] Enable local glyph generation using TinySDF.
- Platform-specific LocalGlyphRasterizer is responsible for deciding which glyphs to rasterize locally and for implementing the rasterization.
 - Default platform implementation doesn't locally generate any glyphs -> no behavior change
 - Unit test uses StubLocalGlyphRasterizer, which returns a single fixed bitmap for all CJK glyphs
 - Rename glyph_loader.test to glyph_manager.test
2017-12-11 10:43:00 -08:00
Konstantin Käfer
2eec5a1980 [core] move HeadlessBackend extension initialization code into Impl 2017-11-29 15:48:51 +01:00
Konstantin Käfer
335f04f7e1 [core] fold HeadlessDisplay into the headless RenderBackend implementation 2017-11-29 15:48:51 +01:00
Chris Loer
5da5ba7706 [core, ios, qt, android] Close race condition in RunLoop (issue #9620)
Because a message we queue from the foreground may cause the background to complete, exit, and tear down the AsyncTask, we have to block queue processing until we've finished our call to AsyncTask::send().
Broadening the scope of a mutex is scary, but I audited the code of our four implementations of AsyncTask and I don't see any way this could cause a deadlock.
2017-11-27 14:42:44 -08:00
Asheem Mamoowala
acae193861 [core] Custom Geometry Sources 2017-11-22 13:56:38 -08:00