Android/core: Couple a sequenced scheduler to the lifetime of a GeoJSON source (#2182)
This commit is contained in:
@@ -245,7 +245,8 @@ void FeatureConverter::convertJson(std::shared_ptr<std::string> json, ActorRef<G
|
||||
return;
|
||||
}
|
||||
|
||||
callback.invoke(&GeoJSONDataCallback::operator(), style::GeoJSONData::create(*converted, options));
|
||||
callback.invoke(&GeoJSONDataCallback::operator(),
|
||||
style::GeoJSONData::create(*converted, sequencedScheduler, options));
|
||||
}
|
||||
|
||||
template <class JNIType>
|
||||
@@ -257,7 +258,8 @@ void FeatureConverter::convertObject(
|
||||
android::UniqueEnv _env = android::AttachEnv();
|
||||
// Convert the jni object
|
||||
auto geometry = JNIType::convert(*_env, *jObject);
|
||||
callback.invoke(&GeoJSONDataCallback::operator(), style::GeoJSONData::create(geometry, options));
|
||||
callback.invoke(&GeoJSONDataCallback::operator(),
|
||||
style::GeoJSONData::create(geometry, sequencedScheduler, options));
|
||||
}
|
||||
|
||||
Update::Update(Converter _converterFn, std::unique_ptr<Actor<GeoJSONDataCallback>> _callback)
|
||||
|
||||
@@ -16,7 +16,8 @@ using GeoJSONDataCallback = std::function<void(std::shared_ptr<style::GeoJSONDat
|
||||
class FeatureConverter {
|
||||
public:
|
||||
explicit FeatureConverter(Immutable<style::GeoJSONOptions> options_)
|
||||
: options(std::move(options_)) {}
|
||||
: options(std::move(options_)),
|
||||
sequencedScheduler(Scheduler::GetSequenced()) {}
|
||||
void convertJson(std::shared_ptr<std::string>, ActorRef<GeoJSONDataCallback>);
|
||||
|
||||
template <class JNIType>
|
||||
@@ -25,6 +26,7 @@ public:
|
||||
|
||||
private:
|
||||
Immutable<style::GeoJSONOptions> options;
|
||||
std::shared_ptr<Scheduler> sequencedScheduler;
|
||||
};
|
||||
|
||||
struct Update {
|
||||
|
||||
Reference in New Issue
Block a user