summaryrefslogtreecommitdiff
path: root/benchmark/api/render.benchmark.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-19 16:57:36 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-20 21:30:08 +0200
commitd5868d3da822f2bf3297229bd879e76853108a63 (patch)
treeb3d28aab92b938cf541f917f1027d2bbd06d9780 /benchmark/api/render.benchmark.cpp
parentd1762d7111b39d45430bd7bb75ea60b7a5d85bd2 (diff)
downloadqtlocation-mapboxgl-d5868d3da822f2bf3297229bd879e76853108a63.tar.gz
[core] Remove file source from public Map ctor
Diffstat (limited to 'benchmark/api/render.benchmark.cpp')
-rw-r--r--benchmark/api/render.benchmark.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp
index 9a91e8b3bc..0e7a3be322 100644
--- a/benchmark/api/render.benchmark.cpp
+++ b/benchmark/api/render.benchmark.cpp
@@ -8,7 +8,7 @@
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
-#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/storage/resource_options.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -22,11 +22,9 @@ class RenderBenchmark {
public:
RenderBenchmark() {
NetworkStatus::Set(NetworkStatus::Status::Offline);
- fileSource.setAccessToken("foobar");
}
util::RunLoop loop;
- DefaultFileSource fileSource { "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool { 4 };
};
@@ -42,8 +40,9 @@ static void prepare(Map& map, optional<std::string> json = {}) {
static void API_renderStill_reuse_map(::benchmark::State& state) {
RenderBenchmark bench;
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
- Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
- bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool,
+ MapOptions().withMapMode(MapMode::Static),
+ ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") };
prepare(map);
while (state.KeepRunning()) {
@@ -54,8 +53,9 @@ static void API_renderStill_reuse_map(::benchmark::State& state) {
static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) {
RenderBenchmark bench;
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
- Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
- bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool,
+ MapOptions().withMapMode(MapMode::Static),
+ ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") };
prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json"));
while (state.KeepRunning()) {
@@ -66,8 +66,9 @@ 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.threadPool };
- Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
- bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool,
+ MapOptions().withMapMode(MapMode::Static),
+ ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") };
while (state.KeepRunning()) {
prepare(map, { "{}" });
@@ -79,11 +80,11 @@ static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {
static void API_renderStill_recreate_map(::benchmark::State& state) {
RenderBenchmark bench;
-
+ auto mapOptions = MapOptions().withMapMode(MapMode::Static);
+ auto resourceOptions = ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar");
while (state.KeepRunning()) {
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
- Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
- bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, mapOptions, resourceOptions };
prepare(map);
frontend.render(map);
}