[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

@@ -16,20 +16,16 @@ class Request;
class VectorTileData : public TileData {
public:
VectorTileData(const TileID&,
Style&,
const SourceInfo&,
float angle_,
float pitch_,
bool collisionDebug_);
VectorTileData(
const TileID&, Style&, const SourceInfo&, float angle_, float pitch_, bool collisionDebug_);
~VectorTileData();
Bucket* getBucket(const StyleLayer&) override;
void request(float pixelRatio,
const std::function<void()>& callback);
void request(float pixelRatio, const std::function<void()>& callback);
bool reparse(std::function<void ()> callback) override;
void parse(std::function<void()> callback);
bool parsePending(std::function<void()> callback) override;
void redoPlacement(float angle, float pitch, bool collisionDebug) override;
@@ -39,7 +35,11 @@ private:
Worker& worker;
TileWorker tileWorker;
std::unique_ptr<WorkRequest> workRequest;
bool parsing = false;
// Contains all the Bucket objects for the tile. Buckets are render
// objects and they get added by tile parsing operations.
std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;
const SourceInfo& source;
RequestHolder req;
std::shared_ptr<const std::string> data;
@@ -49,9 +49,8 @@ private:
float currentPitch;
bool lastCollisionDebug = 0;
bool currentCollisionDebug = 0;
bool redoingPlacement = false;
};
}
} // namespace mbgl
#endif