summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/actor/actor.test.cpp41
-rw-r--r--test/actor/actor_ref.test.cpp14
-rw-r--r--test/api/annotations.test.cpp6
-rw-r--r--test/api/api_misuse.test.cpp6
-rw-r--r--test/api/custom_geometry_source.test.cpp6
-rw-r--r--test/api/custom_layer.test.cpp6
-rw-r--r--test/api/query.test.cpp6
-rw-r--r--test/api/recycle_map.cpp6
-rw-r--r--test/gl/context.test.cpp6
-rw-r--r--test/map/map.test.cpp15
-rw-r--r--test/map/prefetch.test.cpp6
-rw-r--r--test/renderer/image_manager.test.cpp1
-rw-r--r--test/sprite/sprite_loader.test.cpp4
-rw-r--r--test/style/source.test.cpp6
-rw-r--r--test/style/style.test.cpp10
-rw-r--r--test/style/style_layer.test.cpp4
-rw-r--r--test/text/local_glyph_rasterizer.test.cpp6
-rw-r--r--test/tile/custom_geometry_tile.test.cpp5
-rw-r--r--test/tile/geojson_tile.test.cpp5
-rw-r--r--test/tile/raster_dem_tile.test.cpp5
-rw-r--r--test/tile/raster_tile.test.cpp5
-rw-r--r--test/tile/vector_tile.test.cpp5
-rw-r--r--test/util/async_task.test.cpp16
-rw-r--r--test/util/memory.test.cpp16
-rw-r--r--test/util/thread.test.cpp10
25 files changed, 70 insertions, 146 deletions
diff --git a/test/actor/actor.test.cpp b/test/actor/actor.test.cpp
index 7493abe263..a2266cd7a2 100644
--- a/test/actor/actor.test.cpp
+++ b/test/actor/actor.test.cpp
@@ -1,5 +1,4 @@
#include <mbgl/actor/actor.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/test/util.hpp>
@@ -20,9 +19,8 @@ TEST(Actor, Construction) {
};
};
- ThreadPool pool { 1 };
bool constructed = false;
- Actor<Test> test(pool, std::ref(constructed));
+ Actor<Test> test(Scheduler::GetBackground(), std::ref(constructed));
EXPECT_TRUE(constructed);
}
@@ -37,10 +35,9 @@ TEST(Actor, Destruction) {
bool& destructed;
};
- ThreadPool pool { 1 };
bool destructed = false;
{
- Actor<Test> test(pool, std::ref(destructed));
+ Actor<Test> test(Scheduler::GetBackground(), std::ref(destructed));
}
EXPECT_TRUE(destructed);
@@ -72,15 +69,13 @@ TEST(Actor, DestructionBlocksOnReceive) {
}
};
- ThreadPool pool { 1 };
-
std::promise<void> enteredPromise;
std::future<void> enteredFuture = enteredPromise.get_future();
std::promise<void> exitingPromise;
std::future<void> exitingFuture = exitingPromise.get_future();
- Actor<Test> test(pool, std::move(enteredPromise), std::move(exitingFuture));
+ Actor<Test> test(Scheduler::GetBackground(), std::move(enteredPromise), std::move(exitingFuture));
test.self().invoke(&Test::wait);
enteredFuture.wait();
@@ -157,11 +152,8 @@ TEST(Actor, DestructionAllowedInReceiveOnSameThread) {
}
};
- ThreadPool pool { 1 };
-
std::promise<void> callbackFiredPromise;
-
- auto test = std::make_unique<Actor<Test>>(pool);
+ auto test = std::make_unique<Actor<Test>>(Scheduler::GetBackground());
// Callback (triggered while mutex is locked in Mailbox::receive())
test->self().invoke(&Test::callMeBack, [&]() {
@@ -189,12 +181,10 @@ TEST(Actor, SelfDestructionDoesntCrashWaitingReceivingThreads) {
};
- ThreadPool pool { 2 };
-
std::promise<void> actorClosedPromise;
- auto closingActor = std::make_unique<Actor<Test>>(pool);
- auto waitingActor = std::make_unique<Actor<Test>>(pool);
+ auto closingActor = std::make_unique<Actor<Test>>(Scheduler::GetBackground());
+ auto waitingActor = std::make_unique<Actor<Test>>(Scheduler::GetBackground());
std::atomic<bool> waitingMessageProcessed {false};
@@ -251,11 +241,9 @@ TEST(Actor, OrderedMailbox) {
}
};
- ThreadPool pool { 1 };
-
std::promise<void> endedPromise;
std::future<void> endedFuture = endedPromise.get_future();
- Actor<Test> test(pool, std::move(endedPromise));
+ Actor<Test> test(Scheduler::GetBackground(), std::move(endedPromise));
for (auto i = 1; i <= 10; ++i) {
test.self().invoke(&Test::receive, i);
@@ -287,11 +275,9 @@ TEST(Actor, NonConcurrentMailbox) {
}
};
- ThreadPool pool { 10 };
-
std::promise<void> endedPromise;
std::future<void> endedFuture = endedPromise.get_future();
- Actor<Test> test(pool, std::move(endedPromise));
+ Actor<Test> test(Scheduler::GetBackground(), std::move(endedPromise));
for (auto i = 1; i <= 10; ++i) {
test.self().invoke(&Test::receive, i);
@@ -313,8 +299,7 @@ TEST(Actor, Ask) {
}
};
- ThreadPool pool { 2 };
- Actor<Test> test(pool);
+ Actor<Test> test(Scheduler::GetBackground());
auto result = test.self().ask(&Test::doubleIt, 1);
@@ -339,9 +324,8 @@ TEST(Actor, AskVoid) {
}
};
- ThreadPool pool { 1 };
bool executed = false;
- Actor<Test> actor(pool, executed);
+ Actor<Test> actor(Scheduler::GetBackground(), executed);
actor.self().ask(&Test::doIt).get();
EXPECT_TRUE(executed);
@@ -353,8 +337,7 @@ TEST(Actor, NoSelfActorRef) {
// Trivially constructable
struct Trivial {};
- ThreadPool pool { 2 };
- Actor<Trivial> trivial(pool);
+ Actor<Trivial> trivial(Scheduler::GetBackground());
// With arguments
@@ -372,7 +355,7 @@ TEST(Actor, NoSelfActorRef) {
std::promise<void> promise;
auto future = promise.get_future();
- Actor<WithArguments> withArguments(pool, std::move(promise));
+ Actor<WithArguments> withArguments(Scheduler::GetBackground(), std::move(promise));
withArguments.self().invoke(&WithArguments::receive);
future.wait();
diff --git a/test/actor/actor_ref.test.cpp b/test/actor/actor_ref.test.cpp
index 20aa1c35c1..221a220ed9 100644
--- a/test/actor/actor_ref.test.cpp
+++ b/test/actor/actor_ref.test.cpp
@@ -1,6 +1,6 @@
#include <mbgl/actor/actor.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <mbgl/test/util.hpp>
#include <future>
@@ -27,11 +27,10 @@ TEST(ActorRef, CanOutliveActor) {
}
};
- ThreadPool pool { 1 };
bool died = false;
ActorRef<Test> test = [&] () {
- return Actor<Test>(pool, std::ref(died)).self();
+ return Actor<Test>(Scheduler::GetBackground(), std::ref(died)).self();
}();
EXPECT_TRUE(died);
@@ -54,8 +53,7 @@ TEST(ActorRef, Ask) {
}
};
- ThreadPool pool { 1 };
- Actor<Test> actor(pool);
+ Actor<Test> actor(Scheduler::GetBackground());
ActorRef<Test> ref = actor.self();
EXPECT_EQ(20, ref.ask(&Test::gimme).get());
@@ -76,9 +74,8 @@ TEST(ActorRef, AskVoid) {
}
};
- ThreadPool pool { 1 };
bool executed = false;
- Actor<Test> actor(pool, executed);
+ Actor<Test> actor(Scheduler::GetBackground(), executed);
ActorRef<Test> ref = actor.self();
ref.ask(&Test::doIt).get();
@@ -104,8 +101,7 @@ TEST(ActorRef, AskOnDestroyedActor) {
};
bool died = false;
- ThreadPool pool { 1 };
- auto actor = std::make_unique<Actor<Test>>(pool, died);
+ auto actor = std::make_unique<Actor<Test>>(Scheduler::GetBackground(), died);
ActorRef<Test> ref = actor->self();
actor.reset();
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);
diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp
index f260555f55..5703792a7d 100644
--- a/test/gl/context.test.cpp
+++ b/test/gl/context.test.cpp
@@ -4,7 +4,6 @@
#include <mbgl/gl/context.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>
@@ -87,13 +86,12 @@ TEST(GLContextMode, Shared) {
util::RunLoop loop;
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
- ThreadPool threadPool(4);
float pixelRatio { 1 };
- HeadlessFrontend frontend { pixelRatio, fileSource, threadPool, {}, GLContextMode::Shared };
+ HeadlessFrontend frontend { pixelRatio, fileSource, {}, GLContextMode::Shared };
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(MapMode::Static));
+ fileSource, 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/map/map.test.cpp b/test/map/map.test.cpp
index f45c728944..ecbb92d164 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -8,7 +8,6 @@
#include <mbgl/map/map_options.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/gl/headless_frontend.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/storage/online_file_source.hpp>
@@ -32,15 +31,14 @@ class MapTest {
public:
util::RunLoop runLoop;
FileSource fileSource;
- ThreadPool threadPool { 4 };
StubMapObserver observer;
HeadlessFrontend frontend;
Map map;
MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static)
- : frontend(pixelRatio, fileSource, threadPool)
+ : frontend(pixelRatio, fileSource)
, map(frontend, observer, frontend.getSize(), pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode)) {
+ fileSource, MapOptions().withMapMode(mode)) {
}
template <typename T = FileSource>
@@ -48,9 +46,9 @@ public:
float pixelRatio = 1, MapMode mode = MapMode::Static,
typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = 0)
: fileSource { cachePath, assetRoot }
- , frontend(pixelRatio, fileSource, threadPool)
+ , frontend(pixelRatio, fileSource)
, map(frontend, observer, frontend.getSize(), pixelRatio,
- fileSource, threadPool, MapOptions().withMapMode(mode)) {
+ fileSource, MapOptions().withMapMode(mode)) {
}
};
@@ -671,7 +669,6 @@ TEST(Map, DontLoadUnneededTiles) {
TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
util::RunLoop runLoop;
- ThreadPool threadPool { 4 };
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
float pixelRatio { 1 };
@@ -685,7 +682,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
util::Timer timer;
- HeadlessFrontend frontend(pixelRatio, fileSource, threadPool);
+ HeadlessFrontend frontend(pixelRatio, fileSource);
StubMapObserver observer;
observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode) {
@@ -698,7 +695,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
};
Map map(frontend, observer, frontend.getSize(), pixelRatio, fileSource,
- threadPool, MapOptions().withMapMode(MapMode::Continuous));
+ MapOptions().withMapMode(MapMode::Continuous));
map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json"));
runLoop.run();
diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp
index 9b7d620739..ba1bd5258e 100644
--- a/test/map/prefetch.test.cpp
+++ b/test/map/prefetch.test.cpp
@@ -7,7 +7,6 @@
#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -23,7 +22,6 @@ using namespace std::chrono_literals;
TEST(Map, PrefetchTiles) {
util::RunLoop runLoop;
- ThreadPool threadPool(4);
StubFileSource fileSource;
util::Timer emergencyShutoff;
@@ -37,8 +35,8 @@ TEST(Map, PrefetchTiles) {
runLoop.stop();
};
- HeadlessFrontend frontend { { 512, 512 }, 1, fileSource, threadPool };
- Map map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool,
+ HeadlessFrontend frontend { { 512, 512 }, 1, fileSource };
+ Map map(frontend, observer, frontend.getSize(), 1, fileSource,
MapOptions().withMapMode(MapMode::Continuous));
std::vector<int> tiles;
diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp
index 4a838d0f9c..eecec38430 100644
--- a/test/renderer/image_manager.test.cpp
+++ b/test/renderer/image_manager.test.cpp
@@ -9,7 +9,6 @@
#include <mbgl/util/io.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/string.hpp>
#include <utility>
diff --git a/test/sprite/sprite_loader.test.cpp b/test/sprite/sprite_loader.test.cpp
index 3691572265..122e711f51 100644
--- a/test/sprite/sprite_loader.test.cpp
+++ b/test/sprite/sprite_loader.test.cpp
@@ -8,7 +8,6 @@
#include <mbgl/util/io.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/string.hpp>
#include <utility>
@@ -37,7 +36,6 @@ public:
util::RunLoop loop;
StubFileSource fileSource;
StubSpriteLoaderObserver observer;
- ThreadPool threadPool { 1 };
SpriteLoader spriteLoader{ 1 };
void run() {
@@ -45,7 +43,7 @@ public:
Log::setObserver(std::make_unique<Log::NullObserver>());
spriteLoader.setObserver(&observer);
- spriteLoader.load("test/fixtures/resources/sprite", threadPool, fileSource);
+ spriteLoader.load("test/fixtures/resources/sprite", fileSource);
loop.run();
}
diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp
index 8bc152926f..73212189de 100644
--- a/test/style/source.test.cpp
+++ b/test/style/source.test.cpp
@@ -28,7 +28,6 @@
#include <mbgl/util/image.hpp>
#include <mbgl/util/tileset.hpp>
-#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/range.hpp>
@@ -52,8 +51,7 @@ public:
StubRenderSourceObserver renderSourceObserver;
Transform transform;
TransformState transformState;
- ThreadPool threadPool { 1 };
- Style style { loop, fileSource, 1 };
+ Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -62,7 +60,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
@@ -746,7 +743,6 @@ TEST(Source, ImageSourceImageUpdate) {
TEST(Source, CustomGeometrySourceSetTileData) {
SourceTest test;
- std::shared_ptr<ThreadPool> threadPool = sharedThreadPool();
CustomGeometrySource source("source", CustomGeometrySource::Options());
source.loadDescription(test.fileSource);
diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp
index 7f57651331..72f74d3b01 100644
--- a/test/style/style.test.cpp
+++ b/test/style/style.test.cpp
@@ -9,7 +9,6 @@
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <memory>
@@ -19,9 +18,8 @@ using namespace mbgl::style;
TEST(Style, Properties) {
util::RunLoop loop;
- ThreadPool threadPool{ 1 };
StubFileSource fileSource;
- Style::Impl style { threadPool, fileSource, 1.0 };
+ Style::Impl style { fileSource, 1.0 };
style.loadJSON(R"STYLE({"name": "Test"})STYLE");
ASSERT_EQ("Test", style.getName());
@@ -62,9 +60,8 @@ TEST(Style, Properties) {
TEST(Style, DuplicateSource) {
util::RunLoop loop;
- ThreadPool threadPool{ 1 };
StubFileSource fileSource;
- Style::Impl style { threadPool, fileSource, 1.0 };
+ Style::Impl style { fileSource, 1.0 };
style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json"));
@@ -84,9 +81,8 @@ TEST(Style, RemoveSourceInUse) {
auto log = new FixtureLogObserver();
Log::setObserver(std::unique_ptr<Log::Observer>(log));
- ThreadPool threadPool{ 1 };
StubFileSource fileSource;
- Style::Impl style { threadPool, fileSource, 1.0 };
+ Style::Impl style { fileSource, 1.0 };
style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json"));
diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp
index 50aa643b50..5f9de07dba 100644
--- a/test/style/style_layer.test.cpp
+++ b/test/style/style_layer.test.cpp
@@ -18,7 +18,6 @@
#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/io.hpp>
#include <memory>
@@ -273,9 +272,8 @@ TEST(Layer, DuplicateLayer) {
util::RunLoop loop;
// Setup style
- ThreadPool threadPool{ 1 };
StubFileSource fileSource;
- Style::Impl style { threadPool, fileSource, 1.0 };
+ Style::Impl style { fileSource, 1.0 };
style.loadJSON(util::read_file("test/fixtures/resources/style-unused-sources.json"));
// Add initial layer
diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp
index 20f825c935..5c03945b8c 100644
--- a/test/text/local_glyph_rasterizer.test.cpp
+++ b/test/text/local_glyph_rasterizer.test.cpp
@@ -7,7 +7,6 @@
#include <mbgl/util/color.hpp>
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/gl/headless_frontend.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/style/style.hpp>
/*
@@ -33,17 +32,16 @@ namespace {
class LocalGlyphRasterizerTest {
public:
LocalGlyphRasterizerTest(const optional<std::string> fontFamily)
- : frontend(pixelRatio, fileSource, threadPool, optional<std::string>(), GLContextMode::Unique, fontFamily)
+ : frontend(pixelRatio, fileSource, optional<std::string>(), GLContextMode::Unique, fontFamily)
{
}
util::RunLoop loop;
StubFileSource fileSource;
- ThreadPool threadPool { 4 };
float pixelRatio { 1 };
HeadlessFrontend frontend;
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/local_glyphs/") + name,
diff --git a/test/tile/custom_geometry_tile.test.cpp b/test/tile/custom_geometry_tile.test.cpp
index dc6aaab1ac..834f02879b 100644
--- a/test/tile/custom_geometry_tile.test.cpp
+++ b/test/tile/custom_geometry_tile.test.cpp
@@ -5,7 +5,6 @@
#include <mbgl/tile/custom_geometry_tile.hpp>
#include <mbgl/style/custom_tile_loader.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
@@ -25,8 +24,7 @@ public:
FakeFileSource fileSource;
TransformState transformState;
util::RunLoop loop;
- ThreadPool threadPool { 1 };
- style::Style style { loop, fileSource, 1 };
+ style::Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -35,7 +33,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp
index fb5f3ca6d7..e68103f4a0 100644
--- a/test/tile/geojson_tile.test.cpp
+++ b/test/tile/geojson_tile.test.cpp
@@ -4,7 +4,6 @@
#include <mbgl/tile/geojson_tile.hpp>
#include <mbgl/tile/tile_loader_impl.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
@@ -24,8 +23,7 @@ public:
FakeFileSource fileSource;
TransformState transformState;
util::RunLoop loop;
- ThreadPool threadPool { 1 };
- style::Style style { loop, fileSource, 1 };
+ style::Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -35,7 +33,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
diff --git a/test/tile/raster_dem_tile.test.cpp b/test/tile/raster_dem_tile.test.cpp
index 5a6f5a8c9a..e2e7d44b9b 100644
--- a/test/tile/raster_dem_tile.test.cpp
+++ b/test/tile/raster_dem_tile.test.cpp
@@ -4,7 +4,6 @@
#include <mbgl/tile/tile_loader_impl.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
@@ -20,8 +19,7 @@ public:
FakeFileSource fileSource;
TransformState transformState;
util::RunLoop loop;
- ThreadPool threadPool { 1 };
- style::Style style { loop, fileSource, 1 };
+ style::Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -31,7 +29,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp
index 8b2b3dee61..2e35a94025 100644
--- a/test/tile/raster_tile.test.cpp
+++ b/test/tile/raster_tile.test.cpp
@@ -4,7 +4,6 @@
#include <mbgl/tile/tile_loader_impl.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
@@ -20,8 +19,7 @@ public:
FakeFileSource fileSource;
TransformState transformState;
util::RunLoop loop;
- ThreadPool threadPool { 1 };
- style::Style style { loop, fileSource, 1 };
+ style::Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -31,7 +29,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp
index ed3eda7863..c610d8c1a7 100644
--- a/test/tile/vector_tile.test.cpp
+++ b/test/tile/vector_tile.test.cpp
@@ -4,7 +4,6 @@
#include <mbgl/tile/vector_tile_data.hpp>
#include <mbgl/tile/tile_loader_impl.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/style/style.hpp>
@@ -26,8 +25,7 @@ public:
FakeFileSource fileSource;
TransformState transformState;
util::RunLoop loop;
- ThreadPool threadPool { 1 };
- style::Style style { loop, fileSource, 1 };
+ style::Style style { fileSource, 1 };
AnnotationManager annotationManager { style };
ImageManager imageManager;
GlyphManager glyphManager { fileSource };
@@ -37,7 +35,6 @@ public:
1.0,
MapDebugOptions(),
transformState,
- threadPool,
fileSource,
MapMode::Continuous,
annotationManager,
diff --git a/test/util/async_task.test.cpp b/test/util/async_task.test.cpp
index f3025e8952..46fbf65ca3 100644
--- a/test/util/async_task.test.cpp
+++ b/test/util/async_task.test.cpp
@@ -1,14 +1,14 @@
#include <mbgl/util/async_task.hpp>
-#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
-#include <mbgl/actor/actor_ref.hpp>
+#include <mbgl/actor/actor_ref.hpp>
+#include <mbgl/util/run_loop.hpp>
#include <mbgl/test/util.hpp>
#include <atomic>
#include <future>
#include <vector>
+using namespace mbgl;
using namespace mbgl::util;
namespace {
@@ -104,11 +104,10 @@ TEST(AsyncTask, RequestCoalescingMultithreaded) {
unsigned count = 0, numThreads = 25;
AsyncTask async([&count] { ++count; });
- mbgl::ThreadPool threads(numThreads);
- auto mailbox = std::make_shared<mbgl::Mailbox>(threads);
+ auto mailbox = std::make_shared<Mailbox>(Scheduler::GetBackground());
TestWorker worker(&async);
- mbgl::ActorRef<TestWorker> workerRef(worker, mailbox);
+ ActorRef<TestWorker> workerRef(worker, mailbox);
for (unsigned i = 0; i < numThreads; ++i) {
workerRef.invoke(&TestWorker::run);
@@ -133,11 +132,10 @@ TEST(AsyncTask, ThreadSafety) {
AsyncTask async([&count] { ++count; });
- mbgl::ThreadPool threads(numThreads);
- auto mailbox = std::make_shared<mbgl::Mailbox>(threads);
+ auto mailbox = std::make_shared<Mailbox>(Scheduler::GetBackground());
TestWorker worker(&async);
- mbgl::ActorRef<TestWorker> workerRef(worker, mailbox);
+ ActorRef<TestWorker> workerRef(worker, mailbox);
for (unsigned i = 0; i < numThreads; ++i) {
// The callback runs on the worker, thus the atomic type.
diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp
index a0e64a6704..b64e05124f 100644
--- a/test/util/memory.test.cpp
+++ b/test/util/memory.test.cpp
@@ -5,7 +5,6 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/map_options.hpp>
#include <mbgl/gl/headless_frontend.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/style/style.hpp>
@@ -36,7 +35,6 @@ public:
util::RunLoop runLoop;
StubFileSource fileSource;
- ThreadPool threadPool { 4 };
private:
Response response(const std::string& path) {
@@ -71,9 +69,9 @@ TEST(Memory, Vector) {
MemoryTest test;
float ratio { 2 };
- HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource, test.threadPool };
+ HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource };
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapOptions().withMapMode(MapMode::Static));
map.jumpTo(CameraOptions().withZoom(16));
map.getStyle().loadURL("mapbox://streets");
@@ -84,9 +82,9 @@ TEST(Memory, Raster) {
MemoryTest test;
float ratio { 2 };
- HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource, test.threadPool };
+ HeadlessFrontend frontend { { 256, 256 }, ratio, test.fileSource };
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource,
- test.threadPool, MapOptions().withMapMode(MapMode::Static));
+ MapOptions().withMapMode(MapMode::Static));
map.getStyle().loadURL("mapbox://satellite");
frontend.render(map);
@@ -122,9 +120,9 @@ TEST(Memory, Footprint) {
class FrontendAndMap {
public:
FrontendAndMap(MemoryTest& test_, const char* style)
- : frontend(Size{ 256, 256 }, 2, test_.fileSource, test_.threadPool)
- , map(frontend, MapObserver::nullObserver(), frontend.getSize(), 2, test_.fileSource
- , test_.threadPool, MapOptions().withMapMode(MapMode::Static)) {
+ : frontend(Size{ 256, 256 }, 2, test_.fileSource)
+ , map(frontend, MapObserver::nullObserver(), frontend.getSize(), 2, test_.fileSource,
+ MapOptions().withMapMode(MapMode::Static)) {
map.jumpTo(CameraOptions().withZoom(16));
map.getStyle().loadURL(style);
frontend.render(map);
diff --git a/test/util/thread.test.cpp b/test/util/thread.test.cpp
index 2bcb9d8959..70a3e8ff68 100644
--- a/test/util/thread.test.cpp
+++ b/test/util/thread.test.cpp
@@ -1,8 +1,8 @@
+#include <mbgl/util/thread.hpp>
+
#include <mbgl/actor/actor_ref.hpp>
#include <mbgl/test/util.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/thread.hpp>
#include <mbgl/util/timer.hpp>
#include <atomic>
@@ -139,8 +139,7 @@ TEST(Thread, Concurrency) {
unsigned numMessages = 100000;
std::atomic_uint completed(numMessages);
- ThreadPool threadPool(10);
- Actor<TestWorker> poolWorker(threadPool);
+ Actor<TestWorker> poolWorker(Scheduler::GetBackground());
auto poolWorkerRef = poolWorker.self();
Thread<TestWorker> threadedObject("Test");
@@ -165,8 +164,7 @@ TEST(Thread, Concurrency) {
TEST(Thread, ThreadPoolMessaging) {
auto loop = std::make_shared<RunLoop>();
- ThreadPool threadPool(1);
- Actor<TestWorker> poolWorker(threadPool);
+ Actor<TestWorker> poolWorker(Scheduler::GetBackground());
auto poolWorkerRef = poolWorker.self();
Thread<TestWorker> threadedObject("Test");