summaryrefslogtreecommitdiff
path: root/src/mbgl/map
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-10-04 15:02:01 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-01-13 10:57:23 +0200
commit879c44f661c5eb762c93a721b657859a71aabfc7 (patch)
tree3a542777434e0d685811ce1c66b752dc9ca36e92 /src/mbgl/map
parent86a360534994cb37d3dddc53b71a2858d97419c3 (diff)
downloadqtlocation-mapboxgl-879c44f661c5eb762c93a721b657859a71aabfc7.tar.gz
[core] Modularize FileSource codebase (#15768)
* [core] Introduce FileSourceManager and use it for default platform impl - Add `FileSourceManager` interface that provides access to `FileSource` instances and means of registering / unregistering `FileSource` factories - Split `DefaultFileSource` into smaller parts - Add `DatabaseFileSource` interface and it's default implementation - Remove inter-dependencies between concrete `FileSource` classes * [build] Add files to next build system * [core] Add generic property setters / getters * [core] Remove setOnlineStatus from OnlineFileSource interface * [core] Hide threading implementation details from DatabaseFileSource interface * [core] Make DB file source methods virtual * [core] Add documentation for DatabaseFileSource and rename one method * [core] Use simple callback instead of ActorRef * [core] Remove ActorRef from OnlineFileSource public header * [core] Add callback to FileSource::forward async API * [core] Pass OfflineRegionDefinition by value * [core] Update tests to use modular file sources * [core] Update unit tests * [core] Update unit tests after rebase * [core] Backport low prio fix for cached requests * [core] Backport pack database * [core] Return removed factory from unRegisterFileSourceFactory * [core] Rename shadowed args in onlinefilesource * [core] Remove simple std::function callback aliases * [core] Expose online file source property keys in public header file * [test-runner] Add proxy file source test runner * [cache] Update mbgl-cache utility to use new file source * [metrics] Rebaseline binary size metrics * [offline] Update offline utility * [core] Update changelog
Diffstat (limited to 'src/mbgl/map')
-rw-r--r--src/mbgl/map/map.cpp28
-rw-r--r--src/mbgl/map/map_impl.cpp18
2 files changed, 24 insertions, 22 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index a994af305f..061669f560 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -1,24 +1,24 @@
+#include <mbgl/annotation/annotation_manager.hpp>
+#include <mbgl/layermanager/layer_manager.hpp>
+#include <mbgl/map/camera.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/map/map_impl.hpp>
-#include <mbgl/map/camera.hpp>
#include <mbgl/map/transform.hpp>
-#include <mbgl/annotation/annotation_manager.hpp>
-#include <mbgl/layermanager/layer_manager.hpp>
-#include <mbgl/style/style_impl.hpp>
-#include <mbgl/style/observer.hpp>
-#include <mbgl/renderer/update_parameters.hpp>
+#include <mbgl/math/log2.hpp>
#include <mbgl/renderer/renderer_frontend.hpp>
#include <mbgl/renderer/renderer_observer.hpp>
-#include <mbgl/storage/file_source.hpp>
+#include <mbgl/renderer/update_parameters.hpp>
+#include <mbgl/storage/file_source_manager.hpp>
#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
+#include <mbgl/style/observer.hpp>
+#include <mbgl/style/style_impl.hpp>
#include <mbgl/util/constants.hpp>
-#include <mbgl/util/math.hpp>
#include <mbgl/util/exception.hpp>
+#include <mbgl/util/logging.hpp>
#include <mbgl/util/mapbox.hpp>
+#include <mbgl/util/math.hpp>
#include <mbgl/util/tile_coordinate.hpp>
-#include <mbgl/util/logging.hpp>
-#include <mbgl/math/log2.hpp>
#include <utility>
@@ -30,9 +30,11 @@ Map::Map(RendererFrontend& frontend,
MapObserver& observer,
const MapOptions& mapOptions,
const ResourceOptions& resourceOptions)
- : impl(std::make_unique<Impl>(frontend, observer,
- FileSource::getSharedFileSource(resourceOptions),
- mapOptions)) {}
+ : impl(std::make_unique<Impl>(
+ frontend,
+ observer,
+ FileSourceManager::get() ? FileSourceManager::get()->getFileSource(ResourceLoader, resourceOptions) : nullptr,
+ mapOptions)) {}
Map::Map(std::unique_ptr<Impl> impl_) : impl(std::move(impl_)) {}
diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp
index 69c3de9783..bc2a37fe07 100644
--- a/src/mbgl/map/map_impl.cpp
+++ b/src/mbgl/map/map_impl.cpp
@@ -11,15 +11,15 @@ Map::Impl::Impl(RendererFrontend& frontend_,
MapObserver& observer_,
std::shared_ptr<FileSource> fileSource_,
const MapOptions& mapOptions)
- : observer(observer_),
- rendererFrontend(frontend_),
- 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>(*fileSource, pixelRatio)),
- annotationManager(*style) {
+ : observer(observer_),
+ rendererFrontend(frontend_),
+ 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>(fileSource, pixelRatio)),
+ annotationManager(*style) {
transform.setNorthOrientation(mapOptions.northOrientation());
style->impl->setObserver(this);
rendererFrontend.setObserver(*this);