summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/raster_tile.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-09-16 00:44:33 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-09-16 01:35:44 +0200
commite79c8db871d4631fb480c679309c827c7ccd2e56 (patch)
tree964d8b0d3687a829a252fac20482fdd3030c0430 /src/mbgl/tile/raster_tile.cpp
parent0b8bc22483c61175012d3348ac724142cbac9c7d (diff)
downloadqtlocation-mapboxgl-e79c8db871d4631fb480c679309c827c7ccd2e56.tar.gz
[core] make sure tiles are not treated as complete until all worker operations completedupstream/expired-resources
Previously, when we started a worker operation that eventually throws an exception (e.g. due to the tile not being parseable), and then enqueue another worker operation while the first one is processing, we treated the worker as idle once the first operation's error callback fired, even though the second operation was still in progress. Due to our use of coalescing, I was unable to come up with a reliable test since we'd need to reproduce the behavior described above, which is timing dependent.
Diffstat (limited to 'src/mbgl/tile/raster_tile.cpp')
-rw-r--r--src/mbgl/tile/raster_tile.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mbgl/tile/raster_tile.cpp b/src/mbgl/tile/raster_tile.cpp
index 76c74ab964..2a3c9eeb0e 100644
--- a/src/mbgl/tile/raster_tile.cpp
+++ b/src/mbgl/tile/raster_tile.cpp
@@ -37,18 +37,27 @@ void RasterTile::setData(std::shared_ptr<const std::string> data,
optional<Timestamp> expires_) {
modified = modified_;
expires = expires_;
- worker.invoke(&RasterTileWorker::parse, data);
+
+ pending = true;
+ ++correlationID;
+ worker.invoke(&RasterTileWorker::parse, data, correlationID);
}
-void RasterTile::onParsed(std::unique_ptr<RasterBucket> result) {
+void RasterTile::onParsed(std::unique_ptr<RasterBucket> result, const uint64_t resultCorrelationID) {
bucket = std::move(result);
loaded = true;
+ if (resultCorrelationID == correlationID) {
+ pending = false;
+ }
renderable = bucket ? true : false;
observer->onTileChanged(*this);
}
-void RasterTile::onError(std::exception_ptr err) {
+void RasterTile::onError(std::exception_ptr err, const uint64_t resultCorrelationID) {
loaded = true;
+ if (resultCorrelationID == correlationID) {
+ pending = false;
+ }
observer->onTileError(*this, err);
}