summaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorMike Morris <mikemorris@users.noreply.github.com>2016-10-12 17:28:22 -0400
committerMike Morris <mikemorris@users.noreply.github.com>2016-10-20 14:37:36 -0400
commit817c26111a0d6650e7ebae73e46621626106d0a7 (patch)
tree60a5206f2f7658b06b214d9b7435a65a243d6e83 /test/util
parentab85fdb4524788ce7279e8ac362a0c1edbd5d5df (diff)
downloadqtlocation-mapboxgl-817c26111a0d6650e7ebae73e46621626106d0a7.tar.gz
[core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere Adds NodeThreadPool implementation using AsyncQueue to call Nan::AsyncQueueWorker from main thread
Diffstat (limited to 'test/util')
-rw-r--r--test/util/memory.test.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp
index d1b9f2412a..e2ace99c41 100644
--- a/test/util/memory.test.cpp
+++ b/test/util/memory.test.cpp
@@ -4,6 +4,7 @@
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/platform/default/headless_view.hpp>
+#include <mbgl/platform/default/thread_pool.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -58,6 +59,7 @@ public:
std::shared_ptr<HeadlessDisplay> display { std::make_shared<mbgl::HeadlessDisplay>() };
HeadlessView view { display, 2 };
StubFileSource fileSource;
+ ThreadPool threadPool { 4 };
private:
Response response(const std::string& path) {
@@ -91,7 +93,7 @@ private:
TEST(Memory, Vector) {
MemoryTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setZoom(16); // more map features
map.setStyleURL("mapbox://streets");
@@ -101,7 +103,7 @@ TEST(Memory, Vector) {
TEST(Memory, Raster) {
MemoryTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://satellite");
test::render(map);
@@ -128,7 +130,7 @@ TEST(Memory, Footprint) {
// Warm up buffers and cache.
for (unsigned i = 0; i < 10; ++i) {
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource,test.threadPool, MapMode::Still);
renderMap(&map, "mapbox://streets");
renderMap(&map, "mapbox://satellite");
};
@@ -142,7 +144,7 @@ TEST(Memory, Footprint) {
long vectorInitialRSS = getRSS();
for (unsigned i = 0; i < runs; ++i) {
- auto vector = std::make_unique<Map>(test.view, test.fileSource, MapMode::Still);
+ auto vector = std::make_unique<Map>(test.view, test.fileSource, test.threadPool, MapMode::Still);
renderMap(vector.get(), "mapbox://streets");
maps.push_back(std::move(vector));
};
@@ -151,7 +153,7 @@ TEST(Memory, Footprint) {
long rasterInitialRSS = getRSS();
for (unsigned i = 0; i < runs; ++i) {
- auto raster = std::make_unique<Map>(test.view, test.fileSource, MapMode::Still);
+ auto raster = std::make_unique<Map>(test.view, test.fileSource, test.threadPool, MapMode::Still);
renderMap(raster.get(), "mapbox://satellite");
maps.push_back(std::move(raster));
};