summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnand Thakker <github@anandthakker.net>2018-06-15 16:31:16 -0400
committerAnand Thakker <github@anandthakker.net>2018-06-15 16:31:16 -0400
commit0d2c0556f1378a7c1c4a21fbf177a77954c37142 (patch)
treec83705ff4f8cd60cec13fb8a9ad31cf3af58c37c
parenta3715c46ad32de759fd4cc02d009d94aa39315b2 (diff)
downloadqtlocation-mapboxgl-0d2c0556f1378a7c1c4a21fbf177a77954c37142.tar.gz
Fixup: Use a raw pointer for MapSnapshotter's FileSource
-rw-r--r--platform/android/src/snapshotter/map_snapshotter.cpp4
-rw-r--r--platform/android/src/snapshotter/map_snapshotter.hpp1
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm5
-rw-r--r--platform/default/mbgl/map/map_snapshotter.cpp12
-rw-r--r--platform/default/mbgl/map/map_snapshotter.hpp2
5 files changed, 10 insertions, 14 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp
index c5fd7e21d7..e8fcc61770 100644
--- a/platform/android/src/snapshotter/map_snapshotter.cpp
+++ b/platform/android/src/snapshotter/map_snapshotter.cpp
@@ -36,7 +36,7 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
}
jFileSource = FileSource::getNativePeer(_env, _jFileSource);
- fileSource = std::shared_ptr<mbgl::FileSource>(&mbgl::android::FileSource::getDefaultFileSource(_env, _jFileSource));
+ auto& fileSource = mbgl::android::FileSource::getDefaultFileSource(_env, _jFileSource);
auto size = mbgl::Size { static_cast<uint32_t>(width), static_cast<uint32_t>(height) };
optional<mbgl::CameraOptions> cameraOptions;
@@ -58,7 +58,7 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
showLogo = _showLogo;
// Create the core snapshotter
- snapshotter = std::make_unique<mbgl::MapSnapshotter>(fileSource,
+ snapshotter = std::make_unique<mbgl::MapSnapshotter>(&fileSource,
threadPool,
style,
size,
diff --git a/platform/android/src/snapshotter/map_snapshotter.hpp b/platform/android/src/snapshotter/map_snapshotter.hpp
index 47c7fd912a..7b72452c45 100644
--- a/platform/android/src/snapshotter/map_snapshotter.hpp
+++ b/platform/android/src/snapshotter/map_snapshotter.hpp
@@ -70,7 +70,6 @@ private:
std::unique_ptr<mbgl::MapSnapshotter> snapshotter;
FileSource *jFileSource;
- std::shared_ptr<mbgl::FileSource> fileSource;
void activateFilesource(JNIEnv&);
void deactivateFilesource(JNIEnv&);
bool activatedFilesource = false;
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index 1d52360d88..d9fa044217 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -86,7 +86,6 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
@implementation MGLMapSnapshotter {
std::shared_ptr<mbgl::ThreadPool> _mbglThreadPool;
- std::shared_ptr<mbgl::FileSource> _mbglFileSource;
std::unique_ptr<mbgl::MapSnapshotter> _mbglMapSnapshotter;
std::unique_ptr<mbgl::Actor<mbgl::MapSnapshotter::Callback>> _snapshotCallback;
}
@@ -439,7 +438,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
- (void)setOptions:(MGLMapSnapshotOptions *)options
{
_options = options;
- _mbglFileSource = std::shared_ptr<mbgl::FileSource>([MGLOfflineStorage sharedOfflineStorage].mbglFileSource);
+ mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource;
_mbglThreadPool = mbgl::sharedThreadPool();
std::string styleURL = std::string([options.styleURL.absoluteString UTF8String]);
@@ -470,7 +469,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
}
// Create the snapshotter
- _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(_mbglFileSource, _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds);
+ _mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(mbglFileSource, _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds);
}
@end
diff --git a/platform/default/mbgl/map/map_snapshotter.cpp b/platform/default/mbgl/map/map_snapshotter.cpp
index d7703e15b2..149ef22e7a 100644
--- a/platform/default/mbgl/map/map_snapshotter.cpp
+++ b/platform/default/mbgl/map/map_snapshotter.cpp
@@ -13,7 +13,7 @@ namespace mbgl {
class MapSnapshotter::Impl {
public:
- Impl(std::shared_ptr<FileSource>,
+ Impl(FileSource*,
std::shared_ptr<Scheduler>,
const std::pair<bool, std::string> style,
const Size&,
@@ -40,13 +40,12 @@ public:
void snapshot(ActorRef<MapSnapshotter::Callback>);
private:
- std::shared_ptr<FileSource> fileSource;
std::shared_ptr<Scheduler> scheduler;
HeadlessFrontend frontend;
Map map;
};
-MapSnapshotter::Impl::Impl(std::shared_ptr<FileSource> fileSource_,
+MapSnapshotter::Impl::Impl(FileSource* fileSource,
std::shared_ptr<Scheduler> scheduler_,
const std::pair<bool, std::string> style,
const Size& size,
@@ -54,8 +53,7 @@ MapSnapshotter::Impl::Impl(std::shared_ptr<FileSource> fileSource_,
const optional<CameraOptions> cameraOptions,
const optional<LatLngBounds> region,
const optional<std::string> programCacheDir)
- : fileSource(std::move(fileSource_))
- , scheduler(std::move(scheduler_))
+ : scheduler(std::move(scheduler_))
, frontend(size, pixelRatio, *fileSource, *scheduler, programCacheDir)
, map(frontend, MapObserver::nullObserver(), size, pixelRatio, *fileSource, *scheduler, MapMode::Static) {
@@ -153,7 +151,7 @@ LatLngBounds MapSnapshotter::Impl::getRegion() const {
return map.latLngBoundsForCamera(getCameraOptions());
}
-MapSnapshotter::MapSnapshotter(std::shared_ptr<FileSource> fileSource,
+MapSnapshotter::MapSnapshotter(FileSource* fileSource,
std::shared_ptr<Scheduler> scheduler,
const std::pair<bool, std::string> style,
const Size& size,
@@ -161,7 +159,7 @@ MapSnapshotter::MapSnapshotter(std::shared_ptr<FileSource> fileSource,
const optional<CameraOptions> cameraOptions,
const optional<LatLngBounds> region,
const optional<std::string> programCacheDir)
- : impl(std::make_unique<util::Thread<MapSnapshotter::Impl>>("Map Snapshotter", std::move(fileSource), std::move(scheduler), style, size, pixelRatio, cameraOptions, region, programCacheDir)) {
+ : impl(std::make_unique<util::Thread<MapSnapshotter::Impl>>("Map Snapshotter", fileSource, std::move(scheduler), style, size, pixelRatio, cameraOptions, region, programCacheDir)) {
}
MapSnapshotter::~MapSnapshotter() = default;
diff --git a/platform/default/mbgl/map/map_snapshotter.hpp b/platform/default/mbgl/map/map_snapshotter.hpp
index dd90d54b26..f40d1e4b77 100644
--- a/platform/default/mbgl/map/map_snapshotter.hpp
+++ b/platform/default/mbgl/map/map_snapshotter.hpp
@@ -25,7 +25,7 @@ class Style;
class MapSnapshotter {
public:
- MapSnapshotter(std::shared_ptr<FileSource> fileSource,
+ MapSnapshotter(FileSource* fileSource,
std::shared_ptr<Scheduler> scheduler,
const std::pair<bool, std::string> style,
const Size&,