summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-26 17:47:03 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-26 22:31:59 +0200
commitba4f5efa09b985f0bab99a53dc9ac27dd6fb94ea (patch)
tree48354dd1d9d2d639aa6374bf835c98f13c9ef2eb /platform
parent25d8eab9737111ab1f2af369125705f241543e51 (diff)
downloadqtlocation-mapboxgl-ba4f5efa09b985f0bab99a53dc9ac27dd6fb94ea.tar.gz
[core] OnlineFileSource is never accessed directly
Diffstat (limited to 'platform')
-rw-r--r--platform/android/src/file_source.cpp3
-rw-r--r--platform/android/src/file_source.hpp2
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm4
-rw-r--r--platform/darwin/src/MGLOfflineStorage_Private.h2
-rw-r--r--platform/default/src/mbgl/storage/file_source_manager.cpp2
-rw-r--r--platform/qt/src/qmapboxgl.cpp2
6 files changed, 7 insertions, 8 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp
index 5a46bffd3e..f95066546a 100644
--- a/platform/android/src/file_source.cpp
+++ b/platform/android/src/file_source.cpp
@@ -43,8 +43,7 @@ FileSource::FileSource(jni::JNIEnv& _env, const jni::String& accessToken, const
mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::ResourceLoader, resourceOptions);
databaseSource = std::static_pointer_cast<mbgl::DatabaseFileSource>(std::shared_ptr<mbgl::FileSource>(
mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Database, resourceOptions)));
- onlineSource = std::static_pointer_cast<mbgl::OnlineFileSource>(std::shared_ptr<mbgl::FileSource>(
- mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Network, resourceOptions)));
+ onlineSource = mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Network, resourceOptions);
}
FileSource::~FileSource() {
diff --git a/platform/android/src/file_source.hpp b/platform/android/src/file_source.hpp
index 591bfbc93e..3bf0fed2eb 100644
--- a/platform/android/src/file_source.hpp
+++ b/platform/android/src/file_source.hpp
@@ -75,7 +75,7 @@ private:
std::unique_ptr<Actor<ResourceTransform::TransformCallback>> resourceTransform;
std::function<void()> pathChangeCallback;
std::shared_ptr<mbgl::DatabaseFileSource> databaseSource;
- std::shared_ptr<mbgl::OnlineFileSource> onlineSource;
+ std::shared_ptr<mbgl::FileSource> onlineSource;
std::shared_ptr<mbgl::FileSource> resourceLoader;
};
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index 275a58f418..4c71286b79 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -46,7 +46,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
@property (nonatomic, strong, readwrite) NSMutableArray<MGLOfflinePack *> *packs;
@property (nonatomic) std::shared_ptr<mbgl::DatabaseFileSource> mbglDatabaseFileSource;
-@property (nonatomic) std::shared_ptr<mbgl::OnlineFileSource> mbglOnlineFileSource;
+@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglOnlineFileSource;
@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglFileSource;
@property (nonatomic) std::string mbglCachePath;
@property (nonatomic, getter=isPaused) BOOL paused;
@@ -233,7 +233,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
options.withCachePath(_mbglCachePath)
.withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String);
_mbglFileSource = mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::ResourceLoader, options);
- _mbglOnlineFileSource = std::static_pointer_cast<mbgl::OnlineFileSource>(std::shared_ptr<mbgl::FileSource>(mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Network, options)));
+ _mbglOnlineFileSource = mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Network, options);
_mbglDatabaseFileSource = std::static_pointer_cast<mbgl::DatabaseFileSource>(std::shared_ptr<mbgl::FileSource>(mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Database, options)));
// Observe for changes to the API base URL (and find out the current one).
diff --git a/platform/darwin/src/MGLOfflineStorage_Private.h b/platform/darwin/src/MGLOfflineStorage_Private.h
index 13bddd7999..c01163e766 100644
--- a/platform/darwin/src/MGLOfflineStorage_Private.h
+++ b/platform/darwin/src/MGLOfflineStorage_Private.h
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The shared online file source object owned by the shared offline storage object.
*/
-@property (nonatomic) std::shared_ptr<mbgl::OnlineFileSource> mbglOnlineFileSource;
+@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglOnlineFileSource;
/**
The shared resource loader file source object owned by the shared offline storage object.
diff --git a/platform/default/src/mbgl/storage/file_source_manager.cpp b/platform/default/src/mbgl/storage/file_source_manager.cpp
index 2981096dac..1a13f05568 100644
--- a/platform/default/src/mbgl/storage/file_source_manager.cpp
+++ b/platform/default/src/mbgl/storage/file_source_manager.cpp
@@ -27,7 +27,7 @@ public:
[](const ResourceOptions&) { return std::make_unique<LocalFileSource>(); });
registerFileSourceFactory(FileSourceType::Network, [](const ResourceOptions& options) {
- auto networkSource = std::make_unique<OnlineFileSource>();
+ std::unique_ptr<FileSource> networkSource = std::make_unique<OnlineFileSource>();
networkSource->setProperty(ACCESS_TOKEN_KEY, options.accessToken());
networkSource->setProperty(API_BASE_URL_KEY, options.baseURL());
return networkSource;
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 5b47174b77..14e9d57558 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1753,7 +1753,7 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin
}};
std::shared_ptr<mbgl::FileSource> fs =
mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Network, resourceOptions);
- std::static_pointer_cast<mbgl::OnlineFileSource>(fs)->setResourceTransform(std::move(transform));
+ fs->setResourceTransform(std::move(transform));
}
// Needs to be Queued to give time to discard redundant draw calls via the `renderQueued` flag.