Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

release-frappe backport: [android] Retain a shared thread pool reference #12811

Merged
merged 1 commit into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions platform/android/src/style/sources/geojson_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ namespace android {
GeoJSONSource::GeoJSONSource(jni::JNIEnv& env, jni::String sourceId, jni::Object<> options)
: Source(env, std::make_unique<mbgl::style::GeoJSONSource>(
jni::Make<std::string>(env, sourceId),
convertGeoJSONOptions(env, options))
), converter(std::make_unique<Actor<FeatureConverter>>(*sharedThreadPool())) {
convertGeoJSONOptions(env, options)))
, threadPool(sharedThreadPool())
, converter(std::make_unique<Actor<FeatureConverter>>(*threadPool)) {
}

GeoJSONSource::GeoJSONSource(jni::JNIEnv& env,
mbgl::style::Source& coreSource,
AndroidRendererFrontend& frontend)
: Source(env, coreSource, createJavaPeer(env), frontend)
, converter(std::make_unique<Actor<FeatureConverter>>(*sharedThreadPool())) {
: Source(env, coreSource, createJavaPeer(env), frontend)
, threadPool(sharedThreadPool())
, converter(std::make_unique<Actor<FeatureConverter>>(*threadPool)) {
}

GeoJSONSource::~GeoJSONSource() = default;
Expand Down
1 change: 1 addition & 0 deletions platform/android/src/style/sources/geojson_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class GeoJSONSource : public Source {
jni::Object<Source> createJavaPeer(jni::JNIEnv&);
std::unique_ptr<Update> awaitingUpdate;
std::unique_ptr<Update> update;
std::shared_ptr<ThreadPool> threadPool;
std::unique_ptr<Actor<FeatureConverter>> converter;

template <class JNIType>
Expand Down