diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-29 13:47:59 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-29 17:28:51 +0300 |
commit | 62e1e03c09bbcd0240ed4bd7eeacc156d6b94cc3 (patch) | |
tree | 5d65847ceb7657ef19053ac9ac327570de716a35 | |
parent | becc705f05c00854ff9952925f203ed5cf829774 (diff) | |
download | qtlocation-mapboxgl-62e1e03c09bbcd0240ed4bd7eeacc156d6b94cc3.tar.gz |
[core] Move semantics for OfflineDownload::ensureResource()
-rw-r--r-- | platform/default/include/mbgl/storage/offline_download.hpp | 2 | ||||
-rw-r--r-- | platform/default/src/mbgl/storage/offline_download.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/platform/default/include/mbgl/storage/offline_download.hpp b/platform/default/include/mbgl/storage/offline_download.hpp index 84b319fb5a..fe5d26f9eb 100644 --- a/platform/default/include/mbgl/storage/offline_download.hpp +++ b/platform/default/include/mbgl/storage/offline_download.hpp @@ -46,7 +46,7 @@ private: * While the request is in progress, it is recorded in `requests`. If the download * is deactivated, all in progress requests are cancelled. */ - void ensureResource(const Resource&, std::function<void (Response)> = {}); + void ensureResource(Resource&&, std::function<void (Response)> = {}); void onMapboxTileCountLimitExceeded(); diff --git a/platform/default/src/mbgl/storage/offline_download.cpp b/platform/default/src/mbgl/storage/offline_download.cpp index bdcc99cc15..e27e645a13 100644 --- a/platform/default/src/mbgl/storage/offline_download.cpp +++ b/platform/default/src/mbgl/storage/offline_download.cpp @@ -228,7 +228,7 @@ void OfflineDownload::activateDownload() { styleResource.setPriority(Resource::Priority::Low); styleResource.setUsage(Resource::Usage::Offline); - ensureResource(styleResource, [&](Response styleResponse) { + ensureResource(std::move(styleResource), [&](Response styleResponse) { status.requiredResourceCountIsPrecise = true; style::Parser parser; @@ -250,7 +250,7 @@ void OfflineDownload::activateDownload() { sourceResource.setPriority(Resource::Priority::Low); sourceResource.setUsage(Resource::Usage::Offline); - ensureResource(sourceResource, [=](Response sourceResponse) { + ensureResource(std::move(sourceResource), [=](Response sourceResponse) { style::conversion::Error error; optional<Tileset> tileset = style::conversion::convertJSON<Tileset>(*sourceResponse.data, error); if (tileset) { @@ -358,7 +358,7 @@ void OfflineDownload::continueDownload() { } while (!resourcesRemaining.empty() && requests.size() < onlineFileSource.getMaximumConcurrentRequests()) { - ensureResource(resourcesRemaining.front()); + ensureResource(std::move(resourcesRemaining.front())); resourcesRemaining.pop_front(); } } @@ -391,7 +391,7 @@ void OfflineDownload::queueTiles(SourceType type, uint16_t tileSize, const Tiles }); } -void OfflineDownload::ensureResource(const Resource& resource, +void OfflineDownload::ensureResource(Resource&& resource, std::function<void(Response)> callback) { assert(resource.priority == Resource::Priority::Low); assert(resource.usage == Resource::Usage::Offline); |