From 8cc100bfd56955c629d5da0bc49ce2bdbae52946 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 13 Mar 2019 16:24:27 +0200 Subject: [core] Get FileSource via UpdateParameters in Renderer::Impl --- benchmark/api/query.benchmark.cpp | 2 +- benchmark/api/render.benchmark.cpp | 6 +++--- bin/render.cpp | 2 +- include/mbgl/renderer/renderer.hpp | 3 +-- .../main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java | 4 +--- platform/android/src/android_renderer_frontend.cpp | 1 - platform/android/src/map_renderer.cpp | 7 ++----- platform/android/src/map_renderer.hpp | 3 --- platform/default/include/mbgl/gl/headless_frontend.hpp | 5 ++--- platform/default/src/mbgl/gl/headless_frontend.cpp | 8 ++++---- platform/default/src/mbgl/map/map_snapshotter.cpp | 2 +- platform/glfw/main.cpp | 2 +- platform/ios/src/MGLMapView.mm | 2 +- platform/macos/src/MGLMapView.mm | 2 +- platform/node/src/node_map.cpp | 4 ++-- platform/qt/src/qmapboxgl.cpp | 1 - platform/qt/src/qmapboxgl_map_renderer.cpp | 5 ++--- platform/qt/src/qmapboxgl_map_renderer.hpp | 5 +---- platform/qt/src/qmapboxgl_renderer_backend.hpp | 1 - src/mbgl/annotation/annotation_tile.cpp | 1 - src/mbgl/map/map_impl.cpp | 1 + src/mbgl/renderer/renderer.cpp | 3 +-- src/mbgl/renderer/renderer_impl.cpp | 6 ++---- src/mbgl/renderer/renderer_impl.hpp | 4 +--- src/mbgl/renderer/update_parameters.hpp | 2 ++ test/api/annotations.test.cpp | 2 +- test/api/api_misuse.test.cpp | 2 +- test/api/custom_geometry_source.test.cpp | 2 +- test/api/custom_layer.test.cpp | 2 +- test/api/query.test.cpp | 2 +- test/api/recycle_map.cpp | 2 +- test/gl/context.test.cpp | 2 +- test/map/map.test.cpp | 6 +++--- test/map/prefetch.test.cpp | 2 +- test/text/local_glyph_rasterizer.test.cpp | 2 +- test/util/memory.test.cpp | 6 +++--- 36 files changed, 46 insertions(+), 66 deletions(-) diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 275a79372c..47eba7a9fe 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -34,7 +34,7 @@ public: util::RunLoop loop; DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." }; ThreadPool threadPool{ 4 }; - HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSource, threadPool }; + HeadlessFrontend frontend { { 1000, 1000 }, 1, threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static) }; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index f74a31647c..cf08cc4101 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -41,7 +41,7 @@ static void prepare(Map& map, optional json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; + HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; prepare(map); @@ -65,7 +65,7 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; + HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; @@ -81,7 +81,7 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { RenderBenchmark bench; while (state.KeepRunning()) { - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; + HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; prepare(map); diff --git a/bin/render.cpp b/bin/render.cpp index fbf32f9a40..87a1e670b9 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { } ThreadPool threadPool(4); - HeadlessFrontend frontend({ width, height }, pixelRatio, fileSource, threadPool); + HeadlessFrontend frontend({ width, height }, pixelRatio, threadPool); Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp index 644dd0fcf9..1d92f9c0cb 100644 --- a/include/mbgl/renderer/renderer.hpp +++ b/include/mbgl/renderer/renderer.hpp @@ -13,7 +13,6 @@ namespace mbgl { -class FileSource; class RendererBackend; class RendererObserver; class RenderedQueryOptions; @@ -23,7 +22,7 @@ class UpdateParameters; class Renderer { public: - Renderer(RendererBackend&, float pixelRatio_, FileSource&, Scheduler&, + Renderer(RendererBackend&, float pixelRatio_, Scheduler&, GLContextMode = GLContextMode::Unique, const optional programCacheDir = {}, const optional localFontFamily = {}); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java index 3eeb72f5ad..ce1f1f7d27 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java @@ -31,12 +31,11 @@ public abstract class MapRenderer implements MapRendererScheduler { private MapboxMap.OnFpsChangedListener onFpsChangedListener; public MapRenderer(@NonNull Context context, String localIdeographFontFamily) { - FileSource fileSource = FileSource.getInstance(context); float pixelRatio = context.getResources().getDisplayMetrics().density; String programCacheDir = FileSource.getInternalCachePath(context); // Initialise native peer - nativeInitialize(this, fileSource, pixelRatio, programCacheDir, localIdeographFontFamily); + nativeInitialize(this, pixelRatio, programCacheDir, localIdeographFontFamily); } public void onStart() { @@ -115,7 +114,6 @@ public abstract class MapRenderer implements MapRendererScheduler { } private native void nativeInitialize(MapRenderer self, - FileSource fileSource, float pixelRatio, String programCacheDir, String localIdeographFontFamily); diff --git a/platform/android/src/android_renderer_frontend.cpp b/platform/android/src/android_renderer_frontend.cpp index 295ed1766b..21e8da6a21 100644 --- a/platform/android/src/android_renderer_frontend.cpp +++ b/platform/android/src/android_renderer_frontend.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include diff --git a/platform/android/src/map_renderer.cpp b/platform/android/src/map_renderer.cpp index cd8953e4cf..8d226c0008 100644 --- a/platform/android/src/map_renderer.cpp +++ b/platform/android/src/map_renderer.cpp @@ -9,20 +9,17 @@ #include "attach_env.hpp" #include "android_renderer_backend.hpp" #include "map_renderer_runnable.hpp" -#include "file_source.hpp" namespace mbgl { namespace android { MapRenderer::MapRenderer(jni::JNIEnv& _env, const jni::Object& obj, - const jni::Object& _fileSource, jni::jfloat pixelRatio_, const jni::String& programCacheDir_, const jni::String& localIdeographFontFamily_) : javaPeer(_env, obj) , pixelRatio(pixelRatio_) - , fileSource(FileSource::getDefaultFileSource(_env, _fileSource)) , programCacheDir(jni::Make(_env, programCacheDir_)) , localIdeographFontFamily(localIdeographFontFamily_ ? jni::Make(_env, localIdeographFontFamily_) : optional{}) , threadPool(sharedThreadPool()) @@ -174,7 +171,7 @@ void MapRenderer::onSurfaceCreated(JNIEnv&) { // Create the new backend and renderer backend = std::make_unique(); - renderer = std::make_unique(*backend, pixelRatio, fileSource, *threadPool, + renderer = std::make_unique(*backend, pixelRatio, *threadPool, GLContextMode::Unique, programCacheDir, localIdeographFontFamily); rendererRef = std::make_unique>(*renderer, mailbox); @@ -211,7 +208,7 @@ void MapRenderer::registerNative(jni::JNIEnv& env) { // Register the peer jni::RegisterNativePeer(env, javaClass, "nativePtr", - jni::MakePeer&, const jni::Object&, jni::jfloat, const jni::String&, const jni::String&>, + jni::MakePeer&, jni::jfloat, const jni::String&, const jni::String&>, "nativeInitialize", "finalize", METHOD(&MapRenderer::render, "nativeRender"), METHOD(&MapRenderer::onSurfaceCreated, diff --git a/platform/android/src/map_renderer.hpp b/platform/android/src/map_renderer.hpp index fdc3600d02..3e5b99605e 100644 --- a/platform/android/src/map_renderer.hpp +++ b/platform/android/src/map_renderer.hpp @@ -23,7 +23,6 @@ class UpdateParameters; namespace android { class AndroidRendererBackend; -class FileSource; /** * The MapRenderer is a peer class that encapsulates the actions @@ -42,7 +41,6 @@ public: MapRenderer(jni::JNIEnv& _env, const jni::Object&, - const jni::Object&, jni::jfloat pixelRatio, const jni::String& programCacheDir, const jni::String& localIdeographFontFamily); @@ -103,7 +101,6 @@ private: jni::WeakReference, jni::EnvAttachingDeleter> javaPeer; float pixelRatio; - DefaultFileSource& fileSource; std::string programCacheDir; optional localIdeographFontFamily; diff --git a/platform/default/include/mbgl/gl/headless_frontend.hpp b/platform/default/include/mbgl/gl/headless_frontend.hpp index 18f0cfa537..ca3230a809 100644 --- a/platform/default/include/mbgl/gl/headless_frontend.hpp +++ b/platform/default/include/mbgl/gl/headless_frontend.hpp @@ -11,7 +11,6 @@ namespace mbgl { -class FileSource; class Scheduler; class Renderer; class RendererBackend; @@ -20,8 +19,8 @@ class TransformState; class HeadlessFrontend : public RendererFrontend { public: - HeadlessFrontend(float pixelRatio_, FileSource&, Scheduler&, const optional programCacheDir = {}, GLContextMode mode = GLContextMode::Unique, const optional localFontFamily = {}); - HeadlessFrontend(Size, float pixelRatio_, FileSource&, Scheduler&, const optional programCacheDir = {}, GLContextMode mode = GLContextMode::Unique, const optional localFontFamily = {}); + HeadlessFrontend(float pixelRatio_, Scheduler&, const optional programCacheDir = {}, GLContextMode mode = GLContextMode::Unique, const optional localFontFamily = {}); + HeadlessFrontend(Size, float pixelRatio_, Scheduler&, const optional programCacheDir = {}, GLContextMode mode = GLContextMode::Unique, const optional localFontFamily = {}); ~HeadlessFrontend() override; void reset() override; diff --git a/platform/default/src/mbgl/gl/headless_frontend.cpp b/platform/default/src/mbgl/gl/headless_frontend.cpp index 37b0f91f32..f3dae2dbc9 100644 --- a/platform/default/src/mbgl/gl/headless_frontend.cpp +++ b/platform/default/src/mbgl/gl/headless_frontend.cpp @@ -8,11 +8,11 @@ namespace mbgl { -HeadlessFrontend::HeadlessFrontend(float pixelRatio_, FileSource& fileSource, Scheduler& scheduler, const optional programCacheDir, GLContextMode mode, const optional localFontFamily) - : HeadlessFrontend({ 256, 256 }, pixelRatio_, fileSource, scheduler, programCacheDir, mode, localFontFamily) { +HeadlessFrontend::HeadlessFrontend(float pixelRatio_, Scheduler& scheduler, const optional programCacheDir, GLContextMode mode, const optional localFontFamily) + : HeadlessFrontend({ 256, 256 }, pixelRatio_, scheduler, programCacheDir, mode, localFontFamily) { } -HeadlessFrontend::HeadlessFrontend(Size size_, float pixelRatio_, FileSource& fileSource, Scheduler& scheduler, const optional programCacheDir, GLContextMode mode, const optional localFontFamily) +HeadlessFrontend::HeadlessFrontend(Size size_, float pixelRatio_, Scheduler& scheduler, const optional programCacheDir, GLContextMode mode, const optional localFontFamily) : size(size_), pixelRatio(pixelRatio_), backend({ static_cast(size.width * pixelRatio), @@ -23,7 +23,7 @@ HeadlessFrontend::HeadlessFrontend(Size size_, float pixelRatio_, FileSource& fi renderer->render(*updateParameters); } }), - renderer(std::make_unique(backend, pixelRatio, fileSource, scheduler, mode, programCacheDir, localFontFamily)) { + renderer(std::make_unique(backend, pixelRatio, scheduler, mode, programCacheDir, localFontFamily)) { } HeadlessFrontend::~HeadlessFrontend() = default; diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index 56bc9bdb88..415ef7befd 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -57,7 +57,7 @@ MapSnapshotter::Impl::Impl(FileSource* fileSource, const optional programCacheDir, const optional localFontFamily) : scheduler(std::move(scheduler_)) - , frontend(size, pixelRatio, *fileSource, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) + , frontend(size, pixelRatio, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) , map(frontend, MapObserver::nullObserver(), size, pixelRatio, *fileSource, *scheduler, MapOptions().withMapMode(MapMode::Static)) { if (style.first) { diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 8e6905f948..38a41cbf18 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) { } mbgl::ThreadPool threadPool(4); - GLFWRendererFrontend rendererFrontend { std::make_unique(backend, view->getPixelRatio(), fileSource, threadPool), backend }; + GLFWRendererFrontend rendererFrontend { std::make_unique(backend, view->getPixelRatio(), threadPool), backend }; mbgl::Map map(rendererFrontend, backend, view->getSize(), view->getPixelRatio(), fileSource, threadPool, mbgl::MapOptions()); backend.setMap(&map); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index f6ebd8bced..f393dec0c1 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -473,7 +473,7 @@ public: MGLRendererConfiguration *config = [MGLRendererConfiguration currentConfiguration]; _mbglThreadPool = mbgl::sharedThreadPool(); - auto renderer = std::make_unique(*_mbglView, config.scaleFactor, *config.fileSource, *_mbglThreadPool, config.contextMode, config.cacheDir, config.localFontFamilyName); + auto renderer = std::make_unique(*_mbglView, config.scaleFactor, *_mbglThreadPool, config.contextMode, config.cacheDir, config.localFontFamilyName); BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView); diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 7edf34574d..054b91d44c 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -286,7 +286,7 @@ public: _mbglThreadPool = mbgl::sharedThreadPool(); MGLRendererConfiguration *config = [MGLRendererConfiguration currentConfiguration]; - auto renderer = std::make_unique(*_mbglView, config.scaleFactor, *config.fileSource, *_mbglThreadPool, config.contextMode, config.cacheDir, config.localFontFamilyName); + auto renderer = std::make_unique(*_mbglView, config.scaleFactor, *_mbglThreadPool, config.contextMode, config.cacheDir, config.localFontFamilyName); BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView, true); diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 2beab1833f..0d69e606c1 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -620,7 +620,7 @@ void NodeMap::cancel() { reinterpret_cast(h->data)->renderFinished(); }); - frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, fileSource, threadpool); + frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, threadpool); mbgl::MapOptions options; options.withMapMode(mode) .withConstrainMode(mbgl::ConstrainMode::HeightOnly) @@ -1206,7 +1206,7 @@ NodeMap::NodeMap(v8::Local options) }()) , mapObserver(NodeMapObserver()) , fileSource(this) - , frontend(std::make_unique(mbgl::Size { 256, 256 }, pixelRatio, fileSource, threadpool)) + , frontend(std::make_unique(mbgl::Size { 256, 256 }, pixelRatio, threadpool)) , map(std::make_unique(*frontend, mapObserver, frontend->getSize(), diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index a3ec1bf0e4..990e70c97f 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1828,7 +1828,6 @@ void QMapboxGLPrivate::createRenderer() m_mapRenderer = std::make_unique( m_pixelRatio, - *m_fileSourceObj, *m_threadPool, m_mode, m_localFontFamily diff --git a/platform/qt/src/qmapboxgl_map_renderer.cpp b/platform/qt/src/qmapboxgl_map_renderer.cpp index 31b518e6d0..8962a8e052 100644 --- a/platform/qt/src/qmapboxgl_map_renderer.cpp +++ b/platform/qt/src/qmapboxgl_map_renderer.cpp @@ -24,9 +24,8 @@ static auto *getScheduler() { return scheduler.localData().get(); }; -QMapboxGLMapRenderer::QMapboxGLMapRenderer(qreal pixelRatio, - mbgl::DefaultFileSource &fs, mbgl::ThreadPool &tp, QMapboxGLSettings::GLContextMode mode, const QString &localFontFamily) - : m_renderer(std::make_unique(m_backend, pixelRatio, fs, tp, static_cast(mode), mbgl::optional {}, +QMapboxGLMapRenderer::QMapboxGLMapRenderer(qreal pixelRatio, mbgl::ThreadPool &tp, QMapboxGLSettings::GLContextMode mode, const QString &localFontFamily) + : m_renderer(std::make_unique(m_backend, pixelRatio, tp, static_cast(mode), mbgl::optional {}, localFontFamily.isEmpty() ? mbgl::nullopt : mbgl::optional { localFontFamily.toStdString() })) , m_forceScheduler(needsToForceScheduler()) { diff --git a/platform/qt/src/qmapboxgl_map_renderer.hpp b/platform/qt/src/qmapboxgl_map_renderer.hpp index a59cf74997..d771a416da 100644 --- a/platform/qt/src/qmapboxgl_map_renderer.hpp +++ b/platform/qt/src/qmapboxgl_map_renderer.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -27,9 +26,7 @@ class QMapboxGLMapRenderer : public QObject Q_OBJECT public: - QMapboxGLMapRenderer(qreal pixelRatio, mbgl::DefaultFileSource &, - mbgl::ThreadPool &, QMapboxGLSettings::GLContextMode, - const QString &localFontFamily); + QMapboxGLMapRenderer(qreal pixelRatio, mbgl::ThreadPool &, QMapboxGLSettings::GLContextMode, const QString &localFontFamily); virtual ~QMapboxGLMapRenderer(); void render(); diff --git a/platform/qt/src/qmapboxgl_renderer_backend.hpp b/platform/qt/src/qmapboxgl_renderer_backend.hpp index de66b035fc..476b3502c1 100644 --- a/platform/qt/src/qmapboxgl_renderer_backend.hpp +++ b/platform/qt/src/qmapboxgl_renderer_backend.hpp @@ -3,7 +3,6 @@ #include "qmapboxgl.hpp" #include -#include #include class QMapboxGLRendererBackend : public mbgl::RendererBackend diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp index e5e3b68dff..7ece03c78a 100644 --- a/src/mbgl/annotation/annotation_tile.cpp +++ b/src/mbgl/annotation/annotation_tile.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index 863604f99c..84cf324722 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -73,6 +73,7 @@ void Map::Impl::onUpdate() { style->impl->getSourceImpls(), style->impl->getLayerImpls(), annotationManager, + fileSource, prefetchZoomDelta, bool(stillImageRequest), crossSourceCollisions diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index 5a92a675c5..fbd9049207 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -9,12 +9,11 @@ namespace mbgl { Renderer::Renderer(RendererBackend& backend, float pixelRatio_, - FileSource& fileSource_, Scheduler& scheduler_, GLContextMode contextMode_, const optional programCacheDir_, const optional localFontFamily_) - : impl(std::make_unique(backend, pixelRatio_, fileSource_, scheduler_, + : impl(std::make_unique(backend, pixelRatio_, scheduler_, contextMode_, std::move(programCacheDir_), std::move(localFontFamily_))) { } diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 67e648d98b..8a9989dd51 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -37,14 +37,12 @@ static RendererObserver& nullObserver() { Renderer::Impl::Impl(RendererBackend& backend_, float pixelRatio_, - FileSource& fileSource_, Scheduler& scheduler_, GLContextMode contextMode_, const optional programCacheDir_, const optional localFontFamily_) : backend(backend_) , scheduler(scheduler_) - , fileSource(fileSource_) , observer(&nullObserver()) , contextMode(contextMode_) , pixelRatio(pixelRatio_) @@ -78,7 +76,7 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) { void Renderer::Impl::render(const UpdateParameters& updateParameters) { if (!glyphManager) { - glyphManager = std::make_unique(fileSource, std::make_unique(localFontFamily)); + glyphManager = std::make_unique(updateParameters.fileSource, std::make_unique(localFontFamily)); glyphManager->setObserver(this); } @@ -118,7 +116,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { updateParameters.debugOptions, updateParameters.transformState, scheduler, - fileSource, + updateParameters.fileSource, updateParameters.mode, updateParameters.annotationManager, *imageManager, diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp index dca5892311..05bf2e9b2b 100644 --- a/src/mbgl/renderer/renderer_impl.hpp +++ b/src/mbgl/renderer/renderer_impl.hpp @@ -27,7 +27,6 @@ class UpdateParameters; class RenderStaticData; class RenderedQueryOptions; class SourceQueryOptions; -class FileSource; class Scheduler; class GlyphManager; class ImageManager; @@ -37,7 +36,7 @@ class CrossTileSymbolIndex; class Renderer::Impl : public GlyphManagerObserver, public RenderSourceObserver{ public: - Impl(RendererBackend&, float pixelRatio_, FileSource&, Scheduler&, GLContextMode, + Impl(RendererBackend&, float pixelRatio_, Scheduler&, GLContextMode, const optional programCacheDir, const optional localFontFamily_); ~Impl() final; @@ -91,7 +90,6 @@ private: RendererBackend& backend; Scheduler& scheduler; - FileSource& fileSource; RendererObserver* observer; diff --git a/src/mbgl/renderer/update_parameters.hpp b/src/mbgl/renderer/update_parameters.hpp index a668c64f48..da6ed0801e 100644 --- a/src/mbgl/renderer/update_parameters.hpp +++ b/src/mbgl/renderer/update_parameters.hpp @@ -14,6 +14,7 @@ namespace mbgl { class AnnotationManager; +class FileSource; class UpdateParameters { public: @@ -33,6 +34,7 @@ public: const Immutable>> layers; AnnotationManager& annotationManager; + FileSource& fileSource; const uint8_t prefetchZoomDelta; diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index a81d9ff990..89ce357d84 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -31,7 +31,7 @@ public: StubFileSource fileSource; ThreadPool threadPool { 4 }; float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)}; diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 8899173071..2ccfb0a7ff 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -25,7 +25,7 @@ TEST(API, RenderWithoutCallback) { StubFileSource fileSource; ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, threadPool }; auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 4eeca9104b..6959a36f15 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -23,7 +23,7 @@ TEST(CustomGeometrySource, Grid) { DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); auto threadPool = sharedThreadPool(); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, *threadPool }; + HeadlessFrontend frontend { pixelRatio, *threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, *threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index d840925206..18c6dc1692 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -93,7 +93,7 @@ TEST(CustomLayer, Basic) { DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index b9fc3a4a62..5567eabc73 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -36,7 +36,7 @@ public: StubFileSource fileSource; ThreadPool threadPool { 4 }; float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, threadPool }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)}; }; diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index 0883241274..db576b4cf6 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -28,7 +28,7 @@ TEST(API, RecycleMapUpdateImages) { ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, threadPool }; auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp index f260555f55..3c055c2ce0 100644 --- a/test/gl/context.test.cpp +++ b/test/gl/context.test.cpp @@ -90,7 +90,7 @@ TEST(GLContextMode, Shared) { ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool, {}, GLContextMode::Shared }; + HeadlessFrontend frontend { pixelRatio, threadPool, {}, GLContextMode::Shared }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index f45c728944..0197202a9d 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -38,7 +38,7 @@ public: Map map; MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static) - : frontend(pixelRatio, fileSource, threadPool) + : frontend(pixelRatio, threadPool) , map(frontend, observer, frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(mode)) { } @@ -48,7 +48,7 @@ public: float pixelRatio = 1, MapMode mode = MapMode::Static, typename std::enable_if::value>::type* = 0) : fileSource { cachePath, assetRoot } - , frontend(pixelRatio, fileSource, threadPool) + , frontend(pixelRatio, threadPool) , map(frontend, observer, frontend.getSize(), pixelRatio, fileSource, threadPool, MapOptions().withMapMode(mode)) { } @@ -685,7 +685,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { util::Timer timer; - HeadlessFrontend frontend(pixelRatio, fileSource, threadPool); + HeadlessFrontend frontend(pixelRatio, threadPool); StubMapObserver observer; observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode) { diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp index 9b7d620739..dfde3a779b 100644 --- a/test/map/prefetch.test.cpp +++ b/test/map/prefetch.test.cpp @@ -37,7 +37,7 @@ TEST(Map, PrefetchTiles) { runLoop.stop(); }; - HeadlessFrontend frontend { { 512, 512 }, 1, fileSource, threadPool }; + HeadlessFrontend frontend { { 512, 512 }, 1, threadPool }; Map map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool, MapOptions().withMapMode(MapMode::Continuous)); diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index 20f825c935..d0fdb5ee57 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -33,7 +33,7 @@ namespace { class LocalGlyphRasterizerTest { public: LocalGlyphRasterizerTest(const optional fontFamily) - : frontend(pixelRatio, fileSource, threadPool, optional(), GLContextMode::Unique, fontFamily) + : frontend(pixelRatio, threadPool, optional(), GLContextMode::Unique, fontFamily) { } diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp index a0e64a6704..36bed57ab5 100644 --- a/test/util/memory.test.cpp +++ b/test/util/memory.test.cpp @@ -71,7 +71,7 @@ TEST(Memory, Vector) { MemoryTest test; float ratio { 2 }; - HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource, test.threadPool }; + HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, test.threadPool, MapOptions().withMapMode(MapMode::Static)); map.jumpTo(CameraOptions().withZoom(16)); @@ -84,7 +84,7 @@ TEST(Memory, Raster) { MemoryTest test; float ratio { 2 }; - HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource, test.threadPool }; + HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, test.threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadURL("mapbox://satellite"); @@ -122,7 +122,7 @@ TEST(Memory, Footprint) { class FrontendAndMap { public: FrontendAndMap(MemoryTest& test_, const char* style) - : frontend(Size{ 256, 256 }, 2, test_.fileSource, test_.threadPool) + : frontend(Size{ 256, 256 }, 2, test_.threadPool) , map(frontend, MapObserver::nullObserver(), frontend.getSize(), 2, test_.fileSource , test_.threadPool, MapOptions().withMapMode(MapMode::Static)) { map.jumpTo(CameraOptions().withZoom(16)); -- cgit v1.2.1