diff options
-rw-r--r-- | include/mbgl/map/map_options.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/storage/resource_options.hpp | 7 | ||||
-rw-r--r-- | platform/android/src/file_source.cpp | 2 | ||||
-rw-r--r-- | platform/default/src/mbgl/map/map_snapshotter.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/map/map_options.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/storage/resource_options.cpp | 6 |
6 files changed, 14 insertions, 9 deletions
diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index b5dc2930c9..617a2d793a 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -17,8 +17,7 @@ public: MapOptions(); ~MapOptions(); - MapOptions(MapOptions&&); - explicit MapOptions(const MapOptions&); + MapOptions(MapOptions&&) noexcept; /** * @brief Sets the map rendering mode. By default, it is set to Continuous diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp index e8a56920e0..6d603b8cca 100644 --- a/include/mbgl/storage/resource_options.hpp +++ b/include/mbgl/storage/resource_options.hpp @@ -16,8 +16,9 @@ public: ResourceOptions(); ~ResourceOptions(); - ResourceOptions(ResourceOptions&&); - explicit ResourceOptions(const ResourceOptions&); + ResourceOptions(ResourceOptions&&) noexcept; + + ResourceOptions clone() const; /** * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. @@ -112,6 +113,8 @@ public: void* platformContext() const; private: + ResourceOptions(const ResourceOptions&); + class Impl; std::unique_ptr<Impl> impl_; }; diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index 94db563efc..41081cd0fb 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -120,7 +120,7 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object<FileSo mbgl::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env, const jni::Object<FileSource>& jFileSource) { FileSource* fileSource = FileSource::getNativePeer(env, jFileSource); assert(fileSource != nullptr); - return mbgl::ResourceOptions(fileSource->resourceOptions); + return fileSource->resourceOptions.clone(); } void FileSource::registerNative(jni::JNIEnv& env) { diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index cd8482e4ba..ca5eadafbc 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -174,7 +174,7 @@ MapSnapshotter::MapSnapshotter(std::shared_ptr<Scheduler> scheduler, const ResourceOptions& resourceOptions) : impl(std::make_unique<util::Thread<MapSnapshotter::Impl>>( "Map Snapshotter", std::move(scheduler), style, size, pixelRatio, cameraOptions, - region, programCacheDir, localFontFamily, resourceOptions)) {} + region, programCacheDir, localFontFamily, resourceOptions.clone())) {} MapSnapshotter::~MapSnapshotter() = default; diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index d0588a44eb..7c254476d6 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -13,8 +13,7 @@ public: // These requires the complete type of Impl. MapOptions::MapOptions() : impl_(std::make_unique<Impl>()) {} MapOptions::~MapOptions() = default; -MapOptions::MapOptions(MapOptions&&) = default; -MapOptions::MapOptions(const MapOptions& other) : impl_(std::make_unique<Impl>(*other.impl_)) {} +MapOptions::MapOptions(MapOptions&&) noexcept = default; MapOptions& MapOptions::withMapMode(MapMode mode) { impl_->mapMode = mode; diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp index 600b535228..c56a22540b 100644 --- a/src/mbgl/storage/resource_options.cpp +++ b/src/mbgl/storage/resource_options.cpp @@ -16,9 +16,13 @@ public: // These requires the complete type of Impl. ResourceOptions::ResourceOptions() : impl_(std::make_unique<Impl>()) {} ResourceOptions::~ResourceOptions() = default; -ResourceOptions::ResourceOptions(ResourceOptions&&) = default; +ResourceOptions::ResourceOptions(ResourceOptions&&) noexcept = default; ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique<Impl>(*other.impl_)) {} +ResourceOptions ResourceOptions::clone() const { + return ResourceOptions(*this); +} + ResourceOptions& ResourceOptions::withAccessToken(std::string token) { impl_->accessToken = std::move(token); return *this; |