summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/util/filesource.hpp6
-rw-r--r--src/map/map.cpp4
-rw-r--r--src/util/filesource.cpp5
3 files changed, 6 insertions, 9 deletions
diff --git a/include/mbgl/util/filesource.hpp b/include/mbgl/util/filesource.hpp
index 83e2a635e5..0d339cbac7 100644
--- a/include/mbgl/util/filesource.hpp
+++ b/include/mbgl/util/filesource.hpp
@@ -25,16 +25,14 @@ enum class ResourceType : uint8_t {
class FileSource {
public:
- FileSource(const std::shared_ptr<uv::loop> &loop);
+ FileSource();
void setBase(const std::string &value);
const std::string &getBase() const;
- void load(ResourceType type, const std::string &url, std::function<void(platform::Response *)> callback);
+ void load(ResourceType type, const std::string &url, std::function<void(platform::Response *)> callback, const std::shared_ptr<uv::loop> loop = nullptr);
private:
- std::shared_ptr<uv::loop> loop;
-
// Stores a URL that is used as a base for loading resources with relative path.
std::string base;
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 7936eaf300..ef7b9548bd 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -34,7 +34,7 @@ Map::Map(View& view)
: loop(std::make_shared<uv::loop>()),
view(view),
transform(view),
- fileSource(std::make_shared<FileSource>(loop)),
+ fileSource(std::make_shared<FileSource>()),
style(std::make_shared<Style>()),
glyphAtlas(std::make_shared<GlyphAtlas>(1024, 1024)),
glyphStore(std::make_shared<GlyphStore>(fileSource)),
@@ -201,7 +201,7 @@ void Map::setStyleURL(const std::string &url) {
} else {
Log::Error(Event::Setup, "loading style failed: %d (%s)", res->code, res->error_message.c_str());
}
- });
+ }, loop);
}
diff --git a/src/util/filesource.cpp b/src/util/filesource.cpp
index 7f184405f8..2bbf146b0c 100644
--- a/src/util/filesource.cpp
+++ b/src/util/filesource.cpp
@@ -6,8 +6,7 @@
namespace mbgl {
-FileSource::FileSource(const std::shared_ptr<uv::loop> &loop)
- : loop(loop) {}
+FileSource::FileSource() {}
void FileSource::setBase(const std::string &value) {
@@ -18,7 +17,7 @@ const std::string &FileSource::getBase() const {
return base;
}
-void FileSource::load(ResourceType type, const std::string &url, std::function<void(platform::Response *)> callback) {
+void FileSource::load(ResourceType type, const std::string &url, std::function<void(platform::Response *)> callback, const std::shared_ptr<uv::loop> loop) {
// convert relative URLs to absolute URLs
const std::string absoluteURL = [&]() -> std::string {