[core] reparse tiles when new data arrives

We're now reparsing tiles when they expire. We're also swapping out buckets atomically to avoid flickering data; i.e. we're displaying the old data as long as we don't have a new parsed bucket for that layer yet. The parsed buckets now live in the *TileData objects rather than in the TileWorker; only partially parsed == pending buckets will remain in the TileWorker. Once they're parsed, they're moved to the *TileData object.
This commit is contained in:
Konstantin Käfer
2015-10-20 12:19:11 +02:00
parent 5173bf1bb8
commit c0c554e36f
27 changed files with 467 additions and 289 deletions

View File

@@ -242,7 +242,7 @@ bool Source::handlePartialTile(const TileID& id, Worker&) {
return true;
}
return data->reparse([this]() {
return data->parsePending([this]() {
emitTileLoaded(false);
});
}
@@ -364,7 +364,8 @@ bool Source::findLoadedChildren(const TileID& id, int32_t maxCoveringZoom, std::
const TileData::State state = hasTile(child_id);
if (TileData::isReadyState(state)) {
retain.emplace_front(child_id);
} else {
}
if (state != TileData::State::parsed) {
complete = false;
if (z < maxCoveringZoom) {
// Go further down the hierarchy to find more unloaded children.
@@ -384,16 +385,17 @@ bool Source::findLoadedChildren(const TileID& id, int32_t maxCoveringZoom, std::
*
* @return boolean Whether a parent was found.
*/
bool Source::findLoadedParent(const TileID& id, int32_t minCoveringZoom, std::forward_list<TileID>& retain) {
void Source::findLoadedParent(const TileID& id, int32_t minCoveringZoom, std::forward_list<TileID>& retain) {
for (int32_t z = id.z - 1; z >= minCoveringZoom; --z) {
const TileID parent_id = id.parent(z, info.max_zoom);
const TileData::State state = hasTile(parent_id);
if (TileData::isReadyState(state)) {
retain.emplace_front(parent_id);
return true;
if (state == TileData::State::parsed) {
return;
}
}
}
return false;
}
bool Source::update(MapData& data,