[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
This commit is contained in:
@@ -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));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user