diff options
-rw-r--r-- | include/mbgl/style/sources/geojson_source.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/sources/geojson_source.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp index 9569b61df4..df2f9d2daf 100644 --- a/include/mbgl/style/sources/geojson_source.hpp +++ b/include/mbgl/style/sources/geojson_source.hpp @@ -14,7 +14,7 @@ namespace mbgl { class AsyncRequest; - +class Scheduler; namespace style { struct GeoJSONOptions { @@ -81,6 +81,7 @@ public: private: optional<std::string> url; std::unique_ptr<AsyncRequest> req; + std::shared_ptr<Scheduler> threadPool; mapbox::base::WeakPtrFactory<Source> weakFactory {this}; }; diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp index fc8a563fd4..ea6fb5cc68 100644 --- a/src/mbgl/style/sources/geojson_source.cpp +++ b/src/mbgl/style/sources/geojson_source.cpp @@ -19,7 +19,7 @@ Immutable<GeoJSONOptions> GeoJSONOptions::defaultOptions() { } GeoJSONSource::GeoJSONSource(std::string id, Immutable<GeoJSONOptions> options) - : Source(makeMutable<Impl>(std::move(id), std::move(options))) {} + : Source(makeMutable<Impl>(std::move(id), std::move(options))), threadPool(Scheduler::GetBackground()) {} GeoJSONSource::~GeoJSONSource() = default; @@ -98,7 +98,7 @@ void GeoJSONSource::loadDescription(FileSource& fileSource) { loaded = true; observer->onSourceLoaded(*this); }; - Scheduler::GetBackground()->scheduleAndReplyValue(makeImplInBackground, onImplReady); + threadPool->scheduleAndReplyValue(makeImplInBackground, onImplReady); } }); } |