Allow reparsing partial tiles when we have new tiles

When parsing a tile, we request resources from the network, like
sprites and glyphs.

In the rare case of the resources arriving before the tile is
parsed for the first time, if we don't mark it for being parsed
again, it can end up with a tile eternally stuck in the partial
state.
This commit is contained in:
Thiago Marcos P. Santos
2015-05-08 19:21:50 +03:00
parent 3f445e8578
commit 4e7c97466c
4 changed files with 12 additions and 8 deletions

View File

@@ -232,7 +232,7 @@ void Source::handlePartialTile(const TileID& id, Worker& worker) {
return;
}
auto callback = std::bind(&Source::emitTileLoaded, this);
auto callback = std::bind(&Source::emitTileLoaded, this, false);
data->reparse(worker, callback);
}
@@ -273,7 +273,7 @@ TileData::State Source::addTile(MapData& data,
new_tile.data = cache.get(normalized_id.to_uint64());
}
auto callback = std::bind(&Source::emitTileLoaded, this);
auto callback = std::bind(&Source::emitTileLoaded, this, true);
if (!new_tile.data) {
// If we don't find working tile data, we're just going to load it.
if (info.type == SourceType::Vector) {
@@ -520,9 +520,9 @@ void Source::emitSourceLoaded() {
}
}
void Source::emitTileLoaded() {
void Source::emitTileLoaded(bool isNewTile) {
if (observer_) {
observer_->onTileLoaded();
observer_->onTileLoaded(isNewTile);
}
}