Skip to content

Commit

Permalink
Merge branch 'main' into scheduler-lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsnd authored Jun 11, 2024
2 parents c6b6276 + de4dd0b commit e4e3972
Show file tree
Hide file tree
Showing 36 changed files with 1,745 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-yaml
args: [--allow-multiple-documents]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
rev: v18.1.6
hooks:
- id: clang-format
files: '.*\.(hpp|cpp|h)'
Expand Down
31 changes: 0 additions & 31 deletions LICENSE.mbgl-core.md → LICENSES.core.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,37 +602,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

---

### [Optional](https://github.com/akrzemi1/Optional) by Andrzej Krzemienski

```
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
```

---

### [variant](https://github.com/mapbox/variant) by Mapbox

```
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ To get started with MapLibre Native, go to your platform below.

## Documentation

The documentation of MapLibre Native is a work in progress. To get an architectural overview and to learn about the current state of the project and its path forward read the [MapLibre Native Markdown Book](https://maplibre.org/maplibre-native/docs/book/). See below for platform-specific documentation.
- [Android API Documentation](https://maplibre.org/maplibre-native/android/api/), [Android Quickstart](https://maplibre.org/maplibre-native/docs/book/android/getting-started-guide.html)
- [iOS Documentation](https://maplibre.org/maplibre-native/ios/latest/documentation/maplibre/)
- [MapLibre Native Markdown Book](https://maplibre.org/maplibre-native/docs/book/design/ten-thousand-foot-view.html): architectural notes
- [Core C++ API Documentation](https://maplibre.org/maplibre-native/cpp/api/) (unstable)
- Everyone is free to share knowledge and information on the [wiki](https://github.com/maplibre/maplibre-native/wiki)

See below for the platform-specific `README.md` files.

## Platforms

Expand Down
4 changes: 2 additions & 2 deletions include/mbgl/storage/offline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include <mbgl/util/geo.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/util/range.hpp>
#include <mbgl/util/variant.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/storage/response.hpp>

#include <string>
#include <vector>
#include <functional>
#include <variant>

namespace mbgl {

Expand Down Expand Up @@ -71,7 +71,7 @@ class OfflineGeometryRegionDefinition {
/*
* The offline region definition types supported
*/
using OfflineRegionDefinition = variant<OfflineTilePyramidRegionDefinition, OfflineGeometryRegionDefinition>;
using OfflineRegionDefinition = std::variant<OfflineTilePyramidRegionDefinition, OfflineGeometryRegionDefinition>;

/*
* The encoded format is private.
Expand Down
9 changes: 9 additions & 0 deletions include/mbgl/util/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ namespace mbgl {
template <typename... T>
using variant = mapbox::util::variant<T...>;

// https://en.cppreference.com/w/cpp/utility/variant/visit
template <class... Ts>
struct overloaded : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20)
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

} // namespace mbgl
863 changes: 791 additions & 72 deletions platform/android/LICENSE.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions platform/android/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ android-lint-test-app:
# Generates LICENSE.md file based on all Android project dependencies
.PHONY: android-license
android-license:
$(MLN_ANDROID_GRADLE) -Pmapbox.abis=none :MapLibreAndroid:licenseReleaseReport
python scripts/generate-license.py
$(MLN_ANDROID_GRADLE) -Pmapbox.abis=none :MapLibreAndroid:licenseDrawableReleaseReport
python3 scripts/generate-license.py

# Symbolicate ndk stack traces for the arm-v7 abi
.PHONY: android-ndk-stack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ AssetManagerFileSource::AssetManagerFileSource(jni::JNIEnv& env,
const jni::Object<android::AssetManager>& assetManager_,
const ResourceOptions resourceOptions,
const ClientOptions clientOptions)
: assetManager(jni::NewGlobal(env, assetManager_)),
: assetManager(jni::NewGlobal<jni::EnvAttachingDeleter>(env, assetManager_)),
impl(std::make_unique<util::Thread<Impl>>(
util::makeThreadPrioritySetter(platform::EXPERIMENTAL_THREAD_PRIORITY_FILE),
"AssetManagerFileSource",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AssetManagerFileSource : public FileSource {
private:
class Impl;

jni::Global<jni::Object<android::AssetManager>> assetManager;
jni::Global<jni::Object<android::AssetManager>, jni::EnvAttachingDeleter> assetManager;
std::unique_ptr<util::Thread<Impl>> impl;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include "offline_region.hpp"

#include <variant>

#include <mbgl/storage/file_source_manager.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/variant.hpp>

#include "offline_region_definition.hpp"
#include "offline_region_error.hpp"
Expand Down Expand Up @@ -180,13 +183,13 @@ jni::Local<jni::Object<OfflineRegion>> OfflineRegion::New(jni::JNIEnv& env,
const jni::Object<FileSource>& jFileSource,
mbgl::OfflineRegion region) {
// Definition
auto definition = region.getDefinition().match(
[&](const mbgl::OfflineTilePyramidRegionDefinition def) {
return OfflineTilePyramidRegionDefinition::New(env, def);
},
[&](const mbgl::OfflineGeometryRegionDefinition def) {
return OfflineGeometryRegionDefinition::New(env, def);
});
auto definition = std::visit(overloaded{[&](const mbgl::OfflineTilePyramidRegionDefinition def) {
return OfflineTilePyramidRegionDefinition::New(env, def);
},
[&](const mbgl::OfflineGeometryRegionDefinition def) {
return OfflineGeometryRegionDefinition::New(env, def);
}},
region.getDefinition());

// Create region java object
static auto& javaClass = jni::Class<OfflineRegion>::Singleton(env);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ LocalGlyphRasterizer::LocalGlyphRasterizer() {
static auto& javaClass = jni::Class<LocalGlyphRasterizer>::Singleton(*env);
static auto constructor = javaClass.GetConstructor(*env);

javaObject = jni::NewGlobal(*env, javaClass.New(*env, constructor));
javaObject = jni::NewGlobal<jni::EnvAttachingDeleter>(*env, javaClass.New(*env, constructor));
}

PremultipliedImage LocalGlyphRasterizer::drawGlyphBitmap(const std::string& fontFamily,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LocalGlyphRasterizer {
PremultipliedImage drawGlyphBitmap(const std::string& fontFamily, const bool bold, const char16_t glyphID);

private:
jni::Global<jni::Object<LocalGlyphRasterizer>> javaObject;
jni::Global<jni::Object<LocalGlyphRasterizer>, jni::EnvAttachingDeleter> javaObject;
};

} // namespace android
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit e4e3972

Please sign in to comment.