don't automatically move back to main thread
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user