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.
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#include <mbgl/tile/tile.hpp>
|
|
#include <mbgl/tile/tile_observer.hpp>
|
|
#include <mbgl/renderer/buckets/debug_bucket.hpp>
|
|
#include <mbgl/renderer/query.hpp>
|
|
#include <mbgl/util/string.hpp>
|
|
#include <mbgl/util/logging.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
static TileObserver nullObserver;
|
|
|
|
Tile::Tile(OverscaledTileID id_) : id(std::move(id_)), observer(&nullObserver) {
|
|
}
|
|
|
|
Tile::~Tile() = default;
|
|
|
|
void Tile::setObserver(TileObserver* observer_) {
|
|
observer = observer_;
|
|
}
|
|
|
|
void Tile::setTriedCache() {
|
|
triedOptional = true;
|
|
observer->onTileChanged(*this);
|
|
}
|
|
|
|
void Tile::dumpDebugLogs() const {
|
|
Log::Info(Event::General, "Tile::id: %s", util::toString(id).c_str());
|
|
Log::Info(Event::General, "Tile::renderable: %s", isRenderable() ? "yes" : "no");
|
|
Log::Info(Event::General, "Tile::complete: %s", isComplete() ? "yes" : "no");
|
|
}
|
|
|
|
void Tile::queryRenderedFeatures(
|
|
std::unordered_map<std::string, std::vector<Feature>>&,
|
|
const GeometryCoordinates&,
|
|
const TransformState&,
|
|
const std::vector<const RenderLayer*>&,
|
|
const RenderedQueryOptions&) {}
|
|
|
|
void Tile::querySourceFeatures(
|
|
std::vector<Feature>&,
|
|
const SourceQueryOptions&) {}
|
|
|
|
} // namespace mbgl
|