[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:
Thiago Marcos P. Santos
2019-02-14 16:56:17 +02:00
parent 947bc75f56
commit 06f1dc48a2
84 changed files with 220 additions and 377 deletions

View File

@@ -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);