diff options
Diffstat (limited to 'platform/android/src/style/sources/vector_source.cpp')
-rw-r--r-- | platform/android/src/style/sources/vector_source.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/platform/android/src/style/sources/vector_source.cpp b/platform/android/src/style/sources/vector_source.cpp index 48eb4ca51c..e46fc1a94e 100644 --- a/platform/android/src/style/sources/vector_source.cpp +++ b/platform/android/src/style/sources/vector_source.cpp @@ -20,12 +20,12 @@ namespace mbgl { namespace android { - VectorSource::VectorSource(jni::JNIEnv& env, jni::String sourceId, jni::Object<> urlOrTileSet) + VectorSource::VectorSource(jni::JNIEnv& env, const jni::String& sourceId, const jni::Object<>& urlOrTileSet) : Source( env, std::make_unique<mbgl::style::VectorSource>( jni::Make<std::string>(env, sourceId), - convertURLOrTileset(Value(env, jni::SeizeLocal(env, std::move(urlOrTileSet)))) + convertURLOrTileset(Value(env, urlOrTileSet)) ) ) { } @@ -38,41 +38,41 @@ namespace android { VectorSource::~VectorSource() = default; - jni::String VectorSource::getURL(jni::JNIEnv& env) { + jni::Local<jni::String> VectorSource::getURL(jni::JNIEnv& env) { optional<std::string> url = source.as<mbgl::style::VectorSource>()->VectorSource::getURL(); - return url ? jni::Make<jni::String>(env, *url) : jni::String(); + return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>(); } - jni::Array<jni::Object<geojson::Feature>> VectorSource::querySourceFeatures(jni::JNIEnv& env, - jni::Array<jni::String> jSourceLayerIds, - jni::Array<jni::Object<>> jfilter) { + jni::Local<jni::Array<jni::Object<geojson::Feature>>> VectorSource::querySourceFeatures(jni::JNIEnv& env, + const jni::Array<jni::String>& jSourceLayerIds, + const jni::Array<jni::Object<>>& jfilter) { using namespace mbgl::android::conversion; using namespace mbgl::android::geojson; std::vector<mbgl::Feature> features; if (rendererFrontend) { features = rendererFrontend->querySourceFeatures(source.getID(), - { toVector(env, jSourceLayerIds), toFilter(env, jni::SeizeLocal(env, std::move(jfilter))) }); + { toVector(env, jSourceLayerIds), toFilter(env, jfilter) }); } return Feature::convert(env, features); } - jni::Object<Source> VectorSource::createJavaPeer(jni::JNIEnv& env) { - static auto javaClass = jni::Class<VectorSource>::Singleton(env); + jni::Local<jni::Object<Source>> VectorSource::createJavaPeer(jni::JNIEnv& env) { + static auto& javaClass = jni::Class<VectorSource>::Singleton(env); static auto constructor = javaClass.GetConstructor<jni::jlong>(env); - return jni::Object<Source>(javaClass.New(env, constructor, reinterpret_cast<jni::jlong>(this)).Get()); + return javaClass.New(env, constructor, reinterpret_cast<jni::jlong>(this)); } void VectorSource::registerNative(jni::JNIEnv& env) { // Lookup the class - static auto javaClass = jni::Class<VectorSource>::Singleton(env); + static auto& javaClass = jni::Class<VectorSource>::Singleton(env); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) // Register the peer jni::RegisterNativePeer<VectorSource>( env, javaClass, "nativePtr", - std::make_unique<VectorSource, JNIEnv&, jni::String, jni::Object<>>, + jni::MakePeer<VectorSource, const jni::String&, const jni::Object<>&>, "initialize", "finalize", METHOD(&VectorSource::querySourceFeatures, "querySourceFeatures"), |