[core] Add Source::Impl::reload

This commit is contained in:
John Firebaugh
2016-08-27 14:43:28 -07:00
parent 21dc12ee93
commit 5b4f6335e3
9 changed files with 96 additions and 27 deletions

View File

@@ -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,
@@ -97,6 +108,16 @@ Worker::parsePendingGeometryTileLayers(TileWorker& worker,
callback, &worker, config);
}
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,