diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-29 16:29:58 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-29 17:28:51 +0300 |
commit | 42ba8a7d12c5968ecb4624b7228d582fa337e697 (patch) | |
tree | ba6f0d0de68f4607a1fa15df17ea244b37f38ec6 /platform/default | |
parent | f84e46ad2690e3914efe830682b41dd55dc945f3 (diff) | |
download | qtlocation-mapboxgl-42ba8a7d12c5968ecb4624b7228d582fa337e697.tar.gz |
[core] const variables for OfflineDownload batch sizes
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/src/mbgl/storage/offline_download.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/platform/default/src/mbgl/storage/offline_download.cpp b/platform/default/src/mbgl/storage/offline_download.cpp index d28c849541..d426243895 100644 --- a/platform/default/src/mbgl/storage/offline_download.cpp +++ b/platform/default/src/mbgl/storage/offline_download.cpp @@ -21,6 +21,13 @@ #include <set> +namespace { + +const size_t kResourcesBatchSize = 64; +const size_t kMarkBatchSize = 200; + +} // namespace + namespace mbgl { using namespace style; @@ -358,7 +365,7 @@ void OfflineDownload::continueDownload() { return; } - if (resourcesToBeMarkedAsUsed.size() >= 200) markPendingUsedResources(); + if (resourcesToBeMarkedAsUsed.size() >= kMarkBatchSize) markPendingUsedResources(); while (!resourcesRemaining.empty() && requests.size() < onlineFileSource.getMaximumConcurrentRequests()) { ensureResource(std::move(resourcesRemaining.front())); @@ -461,7 +468,7 @@ void OfflineDownload::ensureResource(Resource&& resource, buffer.emplace_back(resource, onlineResponse); // Flush buffer periodically - if (buffer.size() == 64 || resourcesRemaining.size() == 0) { + if (buffer.size() == kResourcesBatchSize || resourcesRemaining.empty()) { try { offlineDatabase.putRegionResources(id, buffer, status); } catch (const MapboxTileLimitExceededException&) { |