From a039c7915e077a92c74a247a37d935ebee1b83a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 9 Apr 2019 14:22:54 +0200 Subject: [android] use a designated thread for GeoJSONSource features conversion --- platform/android/src/style/sources/geojson_source.cpp | 11 ++++------- platform/android/src/style/sources/geojson_source.hpp | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp index a9307afe67..bf4f95e4c4 100644 --- a/platform/android/src/style/sources/geojson_source.cpp +++ b/platform/android/src/style/sources/geojson_source.cpp @@ -17,7 +17,6 @@ #include "../conversion/url_or_tileset.hpp" #include -#include // GeoJSONSource uses a "coalescing" model for high frequency asynchronous data update calls, // which in practice means, that any update that started processing is going to finish @@ -48,16 +47,14 @@ namespace android { : Source(env, std::make_unique( jni::Make(env, sourceId), convertGeoJSONOptions(env, options))) - , threadPool(sharedThreadPool()) - , converter(std::make_unique>(*threadPool)) { + , converter(std::make_unique>("GeoJSONSource")) { } GeoJSONSource::GeoJSONSource(jni::JNIEnv& env, mbgl::style::Source& coreSource, AndroidRendererFrontend& frontend) : Source(env, coreSource, createJavaPeer(env), frontend) - , threadPool(sharedThreadPool()) - , converter(std::make_unique>(*threadPool)) { + , converter(std::make_unique>("GeoJSONSource")) { } GeoJSONSource::~GeoJSONSource() = default; @@ -67,7 +64,7 @@ namespace android { std::shared_ptr json = std::make_shared(jni::Make(env, jString)); Update::Converter converterFn = [this, json](ActorRef _callback) { - converter->self().invoke(&FeatureConverter::convertJson, json, _callback); + converter->actor().invoke(&FeatureConverter::convertJson, json, _callback); }; setAsync(converterFn); @@ -170,7 +167,7 @@ namespace android { auto object = std::make_shared(std::move(global)); Update::Converter converterFn = [this, object](ActorRef _callback) { - converter->self().invoke(&FeatureConverter::convertObject, object, _callback); + converter->actor().invoke(&FeatureConverter::convertObject, object, _callback); }; setAsync(converterFn); diff --git a/platform/android/src/style/sources/geojson_source.hpp b/platform/android/src/style/sources/geojson_source.hpp index e737e41924..fcfbf06f38 100644 --- a/platform/android/src/style/sources/geojson_source.hpp +++ b/platform/android/src/style/sources/geojson_source.hpp @@ -7,6 +7,7 @@ #include "../../geojson/feature_collection.hpp" #include "../../android_renderer_frontend.hpp" #include +#include namespace mbgl { namespace android { @@ -59,8 +60,7 @@ private: jni::Local> createJavaPeer(jni::JNIEnv&); std::unique_ptr awaitingUpdate; std::unique_ptr update; - std::shared_ptr threadPool; - std::unique_ptr> converter; + std::unique_ptr> converter; template void setCollectionAsync(jni::JNIEnv&, const jni::Object&); -- cgit v1.2.1