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 /test/api | |
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 'test/api')
-rw-r--r-- | test/api/annotations.test.cpp | 6 | ||||
-rw-r--r-- | test/api/api_misuse.test.cpp | 6 | ||||
-rw-r--r-- | test/api/custom_geometry_source.test.cpp | 6 | ||||
-rw-r--r-- | test/api/custom_layer.test.cpp | 6 | ||||
-rw-r--r-- | test/api/query.test.cpp | 6 | ||||
-rw-r--r-- | test/api/recycle_map.cpp | 6 |
6 files changed, 12 insertions, 24 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index a81d9ff990..a67e691f69 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -1,7 +1,6 @@ #include <mbgl/test/util.hpp> #include <mbgl/test/stub_file_source.hpp> -#include <mbgl/util/default_thread_pool.hpp> #include <mbgl/annotation/annotation.hpp> #include <mbgl/style/style.hpp> #include <mbgl/style/image.hpp> @@ -29,12 +28,11 @@ class AnnotationTest { public: util::RunLoop loop; StubFileSource fileSource; - ThreadPool threadPool { 4 }; float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapOptions().withMapMode(MapMode::Static)}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/annotations/") + name, diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 8899173071..9490c14e1f 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -7,7 +7,6 @@ #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/gl/headless_frontend.hpp> #include <mbgl/storage/online_file_source.hpp> -#include <mbgl/util/default_thread_pool.hpp> #include <mbgl/util/exception.hpp> #include <mbgl/util/run_loop.hpp> @@ -23,12 +22,11 @@ TEST(API, RenderWithoutCallback) { util::RunLoop loop; StubFileSource fileSource; - ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, + pixelRatio, fileSource, MapOptions().withMapMode(MapMode::Static)); map->renderStill(nullptr); diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 4eeca9104b..54df2e5cfb 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -2,7 +2,6 @@ #include <mbgl/map/map.hpp> #include <mbgl/map/map_options.hpp> -#include <mbgl/util/shared_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/gl/headless_frontend.hpp> #include <mbgl/style/style.hpp> @@ -21,11 +20,10 @@ TEST(CustomGeometrySource, Grid) { util::RunLoop loop; DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); - auto threadPool = sharedThreadPool(); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, *threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - *threadPool, MapOptions().withMapMode(MapMode::Static)); + MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index d840925206..7ea5f57cd8 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -3,7 +3,6 @@ #include <mbgl/platform/gl_functions.hpp> #include <mbgl/map/map.hpp> #include <mbgl/map/map_options.hpp> -#include <mbgl/util/default_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> #include <mbgl/gl/defines.hpp> #include <mbgl/gl/headless_frontend.hpp> @@ -91,11 +90,10 @@ TEST(CustomLayer, Basic) { util::RunLoop loop; DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); - ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)); + MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); map.getStyle().addLayer(std::make_unique<CustomLayer>( diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index b9fc3a4a62..b7359e4e60 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -1,6 +1,5 @@ #include <mbgl/map/map.hpp> #include <mbgl/map/map_options.hpp> -#include <mbgl/util/default_thread_pool.hpp> #include <mbgl/test/stub_file_source.hpp> #include <mbgl/test/util.hpp> #include <mbgl/util/image.hpp> @@ -34,11 +33,10 @@ public: util::RunLoop loop; StubFileSource fileSource; - ThreadPool threadPool { 4 }; float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapOptions().withMapMode(MapMode::Static)}; }; std::vector<Feature> getTopClusterFeature(QueryTest& test) { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index 0883241274..5598dfbd85 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -10,7 +10,6 @@ #include <mbgl/style/sources/geojson_source.hpp> #include <mbgl/style/image.hpp> #include <mbgl/style/style.hpp> -#include <mbgl/util/default_thread_pool.hpp> #include <mbgl/util/exception.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/util/geojson.hpp> @@ -25,12 +24,11 @@ TEST(API, RecycleMapUpdateImages) { util::RunLoop loop; StubFileSource fileSource; - ThreadPool threadPool(4); float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, fileSource, threadPool }; + HeadlessFrontend frontend { pixelRatio, fileSource }; auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, + pixelRatio, fileSource, MapOptions().withMapMode(MapMode::Static)); EXPECT_TRUE(map); |