[core] Use Actors for CustomTileLoader invocation from bindings.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include <mbgl/style/sources/custom_geometry_source.hpp>
|
||||
#include <mbgl/style/custom_tile_loader.hpp>
|
||||
#include <mbgl/style/sources/custom_geometry_source_impl.hpp>
|
||||
#include <mbgl/actor/actor.hpp>
|
||||
#include <mbgl/actor/scheduler.hpp>
|
||||
#include <mbgl/tile/tile_id.hpp>
|
||||
|
||||
#include <mbgl/util/shared_thread_pool.hpp>
|
||||
#include <tuple>
|
||||
#include <map>
|
||||
|
||||
@@ -13,8 +14,7 @@ namespace style {
|
||||
CustomGeometrySource::CustomGeometrySource(std::string id,
|
||||
const CustomGeometrySource::Options options)
|
||||
: Source(makeMutable<CustomGeometrySource::Impl>(std::move(id), options)),
|
||||
mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent())),
|
||||
loader(std::make_unique<CustomTileLoader>(options.fetchTileFunction, options.cancelTileFunction)) {
|
||||
loader(std::make_unique<Actor<CustomTileLoader>>(*sharedThreadPool(), options.fetchTileFunction, options.cancelTileFunction)) {
|
||||
}
|
||||
|
||||
CustomGeometrySource::~CustomGeometrySource() = default;
|
||||
@@ -24,21 +24,21 @@ const CustomGeometrySource::Impl& CustomGeometrySource::impl() const {
|
||||
}
|
||||
|
||||
void CustomGeometrySource::loadDescription(FileSource&) {
|
||||
baseImpl = makeMutable<CustomGeometrySource::Impl>(impl(), ActorRef<CustomTileLoader>(*loader, mailbox));
|
||||
baseImpl = makeMutable<CustomGeometrySource::Impl>(impl(), loader->self());
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
void CustomGeometrySource::setTileData(const CanonicalTileID& tileID,
|
||||
const GeoJSON& data) {
|
||||
loader->setTileData(tileID, data);
|
||||
loader->invoke(&CustomTileLoader::setTileData, tileID, data);
|
||||
}
|
||||
|
||||
void CustomGeometrySource::invalidateTile(const CanonicalTileID& tileID) {
|
||||
loader->invalidateTile(tileID);
|
||||
loader->invoke(&CustomTileLoader::invalidateTile, tileID);
|
||||
}
|
||||
|
||||
void CustomGeometrySource::invalidateRegion(const LatLngBounds& bounds) {
|
||||
loader->invalidateRegion(bounds, impl().getZoomRange());
|
||||
loader->invoke(&CustomTileLoader::invalidateRegion, bounds, impl().getZoomRange());
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
|
||||
Reference in New Issue
Block a user