summaryrefslogtreecommitdiff
path: root/platform/default/mbgl/storage/offline_download.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-23 18:25:36 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-24 13:38:14 -0800
commit065cda83fab02aea85573d9c2d78e9121296582d (patch)
tree8fab316922a052496e67aa49d968224ffbbf0fca /platform/default/mbgl/storage/offline_download.cpp
parent5cefaeb85716b21f2bbe57165a244844114b8dbe (diff)
downloadqtlocation-mapboxgl-065cda83fab02aea85573d9c2d78e9121296582d.tar.gz
[core] Limit total number of offline Mapbox tiles
Diffstat (limited to 'platform/default/mbgl/storage/offline_download.cpp')
-rw-r--r--platform/default/mbgl/storage/offline_download.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/default/mbgl/storage/offline_download.cpp b/platform/default/mbgl/storage/offline_download.cpp
index 228942f1f0..8aa58d6c34 100644
--- a/platform/default/mbgl/storage/offline_download.cpp
+++ b/platform/default/mbgl/storage/offline_download.cpp
@@ -7,6 +7,7 @@
#include <mbgl/layer/symbol_layer.hpp>
#include <mbgl/text/glyph.hpp>
#include <mbgl/util/tile_cover.hpp>
+#include <mbgl/util/mapbox.hpp>
#include <set>
@@ -218,6 +219,13 @@ void OfflineDownload::ensureResource(const Resource& resource, std::function<voi
return;
}
+ if (resource.kind == Resource::Kind::Tile
+ && util::mapbox::isMapboxURL(resource.url)
+ && offlineDatabase.offlineMapboxTileCountLimitExceeded()) {
+ observer->mapboxTileCountLimitExceeded(offlineDatabase.getOfflineMapboxTileCountLimit());
+ return;
+ }
+
auto it = requests.insert(requests.begin(), nullptr);
*it = onlineFileSource.request(resource, [=] (Response onlineResponse) {
if (onlineResponse.error) {