summaryrefslogtreecommitdiff
path: root/src/mbgl/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-27 14:43:28 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-06 12:52:14 -0700
commit5b4f6335e384169bcd88633e38d59a500319a47b (patch)
tree0c4f98790ab6d2814b2db26f6fa72454213c6551 /src/mbgl/util
parent21dc12ee93e890325c61daa0e4183dd1e795f0a9 (diff)
downloadqtlocation-mapboxgl-5b4f6335e384169bcd88633e38d59a500319a47b.tar.gz
[core] Add Source::Impl::reload
Diffstat (limited to 'src/mbgl/util')
-rw-r--r--src/mbgl/util/worker.cpp21
-rw-r--r--src/mbgl/util/worker.hpp5
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mbgl/util/worker.cpp b/src/mbgl/util/worker.cpp
index 39e3b1cea6..e05a5cf837 100644
--- a/src/mbgl/util/worker.cpp
+++ b/src/mbgl/util/worker.cpp
@@ -51,6 +51,17 @@ public:
}
}
+ void redoLayout(TileWorker* worker,
+ std::vector<std::unique_ptr<style::Layer>> layers,
+ PlacementConfig config,
+ std::function<void(TileParseResult)> callback) {
+ try {
+ callback(worker->redoLayout(std::move(layers), config));
+ } catch (...) {
+ callback(std::current_exception());
+ }
+ }
+
void redoPlacement(TileWorker* worker,
const std::unordered_map<std::string, std::unique_ptr<Bucket>>* buckets,
PlacementConfig config,
@@ -98,6 +109,16 @@ Worker::parsePendingGeometryTileLayers(TileWorker& worker,
}
std::unique_ptr<AsyncRequest>
+Worker::redoLayout(TileWorker& worker,
+ std::vector<std::unique_ptr<style::Layer>> layers,
+ PlacementConfig config,
+ std::function<void(TileParseResult)> callback) {
+ current = (current + 1) % threads.size();
+ return threads[current]->invokeWithCallback(&Worker::Impl::redoLayout, callback, &worker,
+ std::move(layers), config);
+}
+
+std::unique_ptr<AsyncRequest>
Worker::redoPlacement(TileWorker& worker,
const std::unordered_map<std::string, std::unique_ptr<Bucket>>& buckets,
PlacementConfig config,
diff --git a/src/mbgl/util/worker.hpp b/src/mbgl/util/worker.hpp
index 3c6d3f64b0..31c41debf2 100644
--- a/src/mbgl/util/worker.hpp
+++ b/src/mbgl/util/worker.hpp
@@ -49,6 +49,11 @@ public:
PlacementConfig config,
std::function<void(TileParseResult)> callback);
+ Request redoLayout(TileWorker&,
+ std::vector<std::unique_ptr<style::Layer>>,
+ PlacementConfig,
+ std::function<void(TileParseResult)> callback);
+
Request redoPlacement(TileWorker&,
const std::unordered_map<std::string, std::unique_ptr<Bucket>>&,
PlacementConfig config,