[core] Added modified, expires information to TileData
This commit is contained in:
@@ -181,7 +181,7 @@ VectorTileMonitor::VectorTileMonitor(const SourceInfo& source, const TileID& id,
|
||||
: url(source.tileURL(id, pixelRatio)) {
|
||||
}
|
||||
|
||||
std::unique_ptr<FileRequest> VectorTileMonitor::monitorTile(std::function<void (std::exception_ptr, std::unique_ptr<GeometryTile>)> callback) {
|
||||
std::unique_ptr<FileRequest> VectorTileMonitor::monitorTile(const GeometryTileMonitor::Callback& callback) {
|
||||
return util::ThreadContext::getFileSource()->request({ Resource::Kind::Tile, url }, [callback, this](Response res) {
|
||||
if (res.data && data == res.data) {
|
||||
// We got the same data again. Abort early.
|
||||
@@ -190,18 +190,18 @@ std::unique_ptr<FileRequest> VectorTileMonitor::monitorTile(std::function<void (
|
||||
|
||||
if (res.error) {
|
||||
if (res.error->reason == Response::Error::Reason::NotFound) {
|
||||
callback(nullptr, nullptr);
|
||||
callback(nullptr, nullptr, res.modified, res.expires);
|
||||
return;
|
||||
} else {
|
||||
std::stringstream message;
|
||||
message << "Failed to load [" << url << "]: " << res.error->message;
|
||||
callback(std::make_exception_ptr(std::runtime_error(message.str())), nullptr);
|
||||
callback(std::make_exception_ptr(std::runtime_error(message.str())), nullptr, res.modified, res.expires);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data = res.data;
|
||||
callback(nullptr, std::make_unique<VectorTile>(data));
|
||||
callback(nullptr, std::make_unique<VectorTile>(data), res.modified, res.expires);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user