From 62e1e03c09bbcd0240ed4bd7eeacc156d6b94cc3 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Thu, 29 Aug 2019 13:47:59 +0300 Subject: [core] Move semantics for OfflineDownload::ensureResource() --- platform/default/include/mbgl/storage/offline_download.hpp | 2 +- platform/default/src/mbgl/storage/offline_download.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'platform/default') 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 ensureResource(Resource&&, std::function = {}); 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 = style::conversion::convertJSON(*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 callback) { assert(resource.priority == Resource::Priority::Low); assert(resource.usage == Resource::Usage::Offline); -- cgit v1.2.1