Make the state attribute private
Also add a virtual setState() method to give subclasses a chance to intercept the change of state. This will be used by VectorTileData to release resources when the TileData becomes immutable.
This commit is contained in:
committed by
Konstantin Käfer
parent
40b604448f
commit
41d619771e
@@ -12,9 +12,9 @@ using namespace mbgl;
|
||||
TileData::TileData(const TileID& id_, const SourceInfo& source_)
|
||||
: id(id_),
|
||||
name(id),
|
||||
state(State::initial),
|
||||
source(source_),
|
||||
env(Environment::Get()),
|
||||
state(State::initial),
|
||||
debugBucket(debugFontBuffer) {
|
||||
// Initialize tile debug coordinates
|
||||
debugFontBuffer.addText(name.c_str(), 50, 200, 5);
|
||||
@@ -28,6 +28,12 @@ const std::string TileData::toString() const {
|
||||
return std::string { "[tile " } + name + "]";
|
||||
}
|
||||
|
||||
void TileData::setState(const State& state_) {
|
||||
assert(!isImmutable());
|
||||
|
||||
state = state_;
|
||||
}
|
||||
|
||||
void TileData::request(Worker& worker, float pixelRatio, std::function<void()> callback) {
|
||||
std::string url = source.tileURL(id, pixelRatio);
|
||||
state = State::loading;
|
||||
|
||||
Reference in New Issue
Block a user