From 879c44f661c5eb762c93a721b657859a71aabfc7 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Fri, 4 Oct 2019 15:02:01 +0300 Subject: [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 --- test/style/source.test.cpp | 2 +- test/style/style.test.cpp | 8 ++++---- test/style/style_layer.test.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test/style') diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 5eb837d92b..0286aaaec3 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -58,7 +58,7 @@ public: StubRenderSourceObserver renderSourceObserver; Transform transform; TransformState transformState; - Style style { *fileSource, 1 }; + Style style{fileSource, 1}; AnnotationManager annotationManager { style }; ImageManager imageManager; GlyphManager glyphManager; diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp index b9e19d5a85..c866431ac1 100644 --- a/test/style/style.test.cpp +++ b/test/style/style.test.cpp @@ -18,7 +18,7 @@ using namespace mbgl::style; TEST(Style, Properties) { util::RunLoop loop; - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style { fileSource, 1.0 }; style.loadJSON(R"STYLE({"name": "Test"})STYLE"); @@ -60,7 +60,7 @@ TEST(Style, Properties) { TEST(Style, DuplicateSource) { util::RunLoop loop; - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style { fileSource, 1.0 }; style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); @@ -81,7 +81,7 @@ TEST(Style, RemoveSourceInUse) { auto log = new FixtureLogObserver(); Log::setObserver(std::unique_ptr(log)); - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style { fileSource, 1.0 }; style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); @@ -106,7 +106,7 @@ TEST(Style, RemoveSourceInUse) { TEST(Style, SourceImplsOrder) { util::RunLoop loop; - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style{fileSource, 1.0}; style.addSource(std::make_unique("c", "mapbox://mapbox.mapbox-terrain-v2")); diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp index 1d60197c2d..77e936ff3b 100644 --- a/test/style/style_layer.test.cpp +++ b/test/style/style_layer.test.cpp @@ -283,7 +283,7 @@ TEST(Layer, DuplicateLayer) { util::RunLoop loop; // Setup style - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style { fileSource, 1.0 }; style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); @@ -304,7 +304,7 @@ TEST(Layer, IncompatibleLayer) { util::RunLoop loop; // Setup style - StubFileSource fileSource; + auto fileSource = std::make_shared(); Style::Impl style{fileSource, 1.0}; style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); -- cgit v1.2.1