Previously, we used the existence of a `prior*` field in the Resource object as an indication for whether we should consult the cache or not. However, this is prone to error, since a failed cache lookup won't set any prior fields. Therefore, we manually set `priorExpires` to 0. This in turn triggered another bug where generated wrong expiration timestamps when the server response we got was expired (or expired between sending and receiving). This commit changes the flags so that we can now explicitly request CacheOnly/NetworkOnly (or All) loading methods, rather than the implicit Optional/Required naming scheme.
29 lines
899 B
C++
29 lines
899 B
C++
#include <mbgl/tile/vector_tile.hpp>
|
|
#include <mbgl/tile/vector_tile_data.hpp>
|
|
#include <mbgl/tile/tile_loader_impl.hpp>
|
|
#include <mbgl/renderer/tile_parameters.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
VectorTile::VectorTile(const OverscaledTileID& id_,
|
|
std::string sourceID_,
|
|
const TileParameters& parameters,
|
|
const Tileset& tileset)
|
|
: GeometryTile(id_, sourceID_, parameters), loader(*this, id_, parameters, tileset) {
|
|
}
|
|
|
|
void VectorTile::setNecessity(TileNecessity necessity) {
|
|
loader.setNecessity(necessity);
|
|
}
|
|
|
|
void VectorTile::setMetadata(optional<Timestamp> modified_, optional<Timestamp> expires_) {
|
|
modified = modified_;
|
|
expires = expires_;
|
|
}
|
|
|
|
void VectorTile::setData(std::shared_ptr<const std::string> data_) {
|
|
GeometryTile::setData(data_ ? std::make_unique<VectorTileData>(data_) : nullptr);
|
|
}
|
|
|
|
} // namespace mbgl
|