Commit Graph

679 Commits

Author SHA1 Message Date
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
Ansis Brammanis
22c07596a0 [core] Split MapMode::Still into Static and Tile
`Tile` makes sure the symbols in the resulting tile are tileable while
symbols in `Still` match rendering in `Continuous` mode.
2017-11-17 10:05:15 -08:00
Bruno de Oliveira Abinader
388610d6aa [core] Expose GLContextMode in HeadlessFrontend 2017-11-01 17:45:37 +02:00
Ivo van Dongen
2c0c516354 [core] map snapshotter - add attributions to snapshotter callback 2017-10-31 19:52:08 +02:00
Ivo van Dongen
87b735aaf7 [default] map snapshotter - add function to get screen coordinate from latlng for snapshot
- Wraps the TransformState for the snapshot so that the snapshotter itself is free to be re-used or destroyed
2017-10-31 19:52:08 +02:00
Ivo van Dongen
316f2bed4b [default] headless frontend - allow access to the transform state 2017-10-31 19:52:08 +02:00
Ivo van Dongen
7481d317e7 [android] map snapshotter - add mutators 2017-10-31 19:52:08 +02:00
Ivo van Dongen
d37144d2f8 [core] map snapshotter - add mutators 2017-10-31 19:52:08 +02:00
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
64c75b442c [build] split out DefaultFileSource and dependents to a separate target
We don't want to link it into the node bindings, so keep it in a separate target
2017-09-28 13:48:36 -04: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
Konstantin Käfer
bd553de7bc [test] add ability to take the OnlineFileSource offline
This functionality is used for testing to ensure correct offline behavior when connectivity is missing.
2017-09-22 10:57:15 +02:00
Lauren Budorick
a9ddf5b7fd Preserve depth buffer between 3D layers + optimize render order (#9931)
Port of https://github.com/mapbox/mapbox-gl-js/pull/5101: adds a new render pass `Pass3D` before any other rendering wherein we render layers with 3D passes (fill-extrusion layers) to offscreen framebuffers, sharing a depth renderbuffer between those layers in order to render 3D space correctly. Those framebuffers are saved on the RenderLayers and copied back to the map during the translucent pass. Rendering to offscreen framebuffers before we do any clear + draw means we can avoid expensive framebuffer restores.
2017-09-21 14:26:48 -07:00
Asheem Mamoowala
2d84e2a1ae Fix platform dependent number type unsigned long -> uint64_t 2017-09-20 09:05:45 -07:00
Asheem Mamoowala
50fd917510 Fast tileCount with help from @mapbox/sphericalmercator module 2017-09-08 17:38:42 -07:00
Ivo van Dongen
fae9faab06 [default] map snapshotter 2017-08-30 17:18:37 +03:00
Ivo van Dongen
eba6d58312 [default] headless_frontend - support program cache dir 2017-08-30 17:18:37 +03:00
Konstantin Käfer
c6ab20e5c6 [core] initialize OfflineDatabase asynchronously in DefaultFileSource
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.
2017-08-28 13:16:27 +02:00
Thiago Marcos P. Santos
558d4b1a88 [core] Remove database on schema downgrade
Previously we were throwing an exception.
2017-08-22 12:46:38 +03:00