diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-02-14 16:56:17 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-08 18:36:02 +0200 |
commit | 9af70cb127d190a9b8257942c6080c8a1b440004 (patch) | |
tree | 708b1b01b3577d05b06273e5fc5b93b501be9788 /platform/darwin/src/MGLMapSnapshotter.mm | |
parent | 5e2b6bf636472a4464e6ab3ae0d9d01c68de041b (diff) | |
download | qtlocation-mapboxgl-9af70cb127d190a9b8257942c6080c8a1b440004.tar.gz |
[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`.
Diffstat (limited to 'platform/darwin/src/MGLMapSnapshotter.mm')
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 3918008b78..7fc21c56c0 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -6,9 +6,7 @@ #import <mbgl/map/map_snapshotter.hpp> #import <mbgl/map/camera.hpp> #import <mbgl/storage/default_file_source.hpp> -#import <mbgl/util/default_thread_pool.hpp> #import <mbgl/util/string.hpp> -#import <mbgl/util/shared_thread_pool.hpp> #import "MGLOfflineStorage_Private.h" #import "MGLGeometry_Private.h" @@ -123,7 +121,6 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; @end @implementation MGLMapSnapshotter { - std::shared_ptr<mbgl::ThreadPool> _mbglThreadPool; std::unique_ptr<mbgl::MapSnapshotter> _mbglMapSnapshotter; std::unique_ptr<mbgl::Actor<mbgl::MapSnapshotter::Callback>> _snapshotCallback; } @@ -174,7 +171,6 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; _mbglMapSnapshotter.reset(); _snapshotCallback.reset(); - _mbglThreadPool.reset(); self.terminated = YES; } @@ -588,7 +584,6 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; _cancelled = NO; _options = options; mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource; - _mbglThreadPool = mbgl::sharedThreadPool(); std::string styleURL = std::string([options.styleURL.absoluteString UTF8String]); std::pair<bool, std::string> style = std::make_pair(false, styleURL); @@ -621,7 +616,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; MGLRendererConfiguration* config = [MGLRendererConfiguration currentConfiguration]; // Create the snapshotter - _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(mbglFileSource, _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName); + _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(mbglFileSource, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName); } @end |