[core] Make the BackgroundScheduler a singleton
- Do not carry it over everywhere as parameter, it is a shared instance anyway and the lifecycle is pretty much the app lifecycle from the moment we instantiate a map. - Rename to BackgroundScheduler because it is a Scheduler that will do tasks in the background, we don't make assumptions if it is a thread pool or a single thread. - Most importantly, remove the dependency from `core` on `platform`.
This commit is contained in:
@@ -9,18 +9,16 @@ namespace mbgl {
|
||||
|
||||
Map::Impl::Impl(RendererFrontend& frontend_,
|
||||
MapObserver& observer_,
|
||||
Scheduler& scheduler_,
|
||||
std::shared_ptr<FileSource> fileSource_,
|
||||
const MapOptions& mapOptions)
|
||||
: observer(observer_),
|
||||
rendererFrontend(frontend_),
|
||||
scheduler(scheduler_),
|
||||
transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()),
|
||||
mode(mapOptions.mapMode()),
|
||||
pixelRatio(mapOptions.pixelRatio()),
|
||||
crossSourceCollisions(mapOptions.crossSourceCollisions()),
|
||||
fileSource(std::move(fileSource_)),
|
||||
style(std::make_unique<style::Style>(scheduler, *fileSource, pixelRatio)),
|
||||
style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
|
||||
annotationManager(*style) {
|
||||
transform.setNorthOrientation(mapOptions.northOrientation());
|
||||
style->impl->setObserver(this);
|
||||
|
||||
Reference in New Issue
Block a user