From c6e58515fcd83a49d8633dc769e1ad1e69074653 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 15 Jul 2015 16:10:09 +0300 Subject: [PATCH] Keep updating until all the tiles are State::parsed This is needed because of a race that can occur now that we requests Glyphs from the Map Thread: The glyph might arrive at the moment a tile is being parsed and they won't be notified again of any new data, remaining forever at the partial state. --- src/mbgl/map/source.cpp | 10 ++-------- src/mbgl/map/tile_worker.cpp | 5 ----- src/mbgl/map/tile_worker.hpp | 1 - src/mbgl/map/vector_tile_data.cpp | 4 ---- src/mbgl/map/vector_tile_data.hpp | 1 - 5 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp index 4ca64747b..a7ebf300f 100644 --- a/src/mbgl/map/source.cpp +++ b/src/mbgl/map/source.cpp @@ -240,14 +240,8 @@ bool Source::handlePartialTile(const TileID& id, Worker&) { return true; } - // The signal is only emitted if there was an actual change on the tile. The - // tile can be in a "partial" state waiting for resources and get reparsed on - // the arrival of new resources that were needed by another tile. - size_t bucketCount = data->countBuckets(); - return data->reparse([this, data, bucketCount]() { - if (data->countBuckets() > bucketCount) { - emitTileLoaded(false); - } + return data->reparse([this, data]() { + emitTileLoaded(false); }); } diff --git a/src/mbgl/map/tile_worker.cpp b/src/mbgl/map/tile_worker.cpp index 15183c0e4..dd56f33f5 100644 --- a/src/mbgl/map/tile_worker.cpp +++ b/src/mbgl/map/tile_worker.cpp @@ -44,11 +44,6 @@ Bucket* TileWorker::getBucket(const StyleLayer& layer) const { return it->second.get(); } -size_t TileWorker::countBuckets() const { - std::lock_guard lock(bucketsMutex); - return buckets.size(); -} - TileParseResult TileWorker::parse(const GeometryTile& geometryTile) { partialParse = false; diff --git a/src/mbgl/map/tile_worker.hpp b/src/mbgl/map/tile_worker.hpp index 2306bf1ac..da5c76650 100644 --- a/src/mbgl/map/tile_worker.hpp +++ b/src/mbgl/map/tile_worker.hpp @@ -41,7 +41,6 @@ public: ~TileWorker(); Bucket* getBucket(const StyleLayer&) const; - size_t countBuckets() const; TileParseResult parse(const GeometryTile&); void redoPlacement(float angle, bool collisionDebug); diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 57b42aaaf..c9ee33910 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -98,10 +98,6 @@ Bucket* VectorTileData::getBucket(const StyleLayer& layer) { return tileWorker.getBucket(layer); } -size_t VectorTileData::countBuckets() const { - return tileWorker.countBuckets(); -} - void VectorTileData::redoPlacement(float angle, bool collisionDebug) { if (angle == currentAngle && collisionDebug == currentCollisionDebug) return; diff --git a/src/mbgl/map/vector_tile_data.hpp b/src/mbgl/map/vector_tile_data.hpp index 3b73ded0c..e0e8be29b 100644 --- a/src/mbgl/map/vector_tile_data.hpp +++ b/src/mbgl/map/vector_tile_data.hpp @@ -23,7 +23,6 @@ public: ~VectorTileData(); Bucket* getBucket(const StyleLayer&) override; - size_t countBuckets() const; void request(float pixelRatio, const std::function& callback);