diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-18 10:48:51 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-18 15:15:24 -0800 |
commit | 7b39ce95210ceb6640b3a3399dacd1d0e826ac1f (patch) | |
tree | eb97fdc8a284826d3a3fe9426a8a10f88a654799 /src/mbgl/map/map_context.cpp | |
parent | d5eb5240f8c35016927e89bf9d186addc09b83fa (diff) | |
download | qtlocation-mapboxgl-7b39ce95210ceb6640b3a3399dacd1d0e826ac1f.tar.gz |
[core] Remove ThreadContext::getFileSource; instead thread FileSource through
Diffstat (limited to 'src/mbgl/map/map_context.cpp')
-rw-r--r-- | src/mbgl/map/map_context.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index d9a7f47125..a4c6abdb21 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -28,8 +28,9 @@ namespace mbgl { -MapContext::MapContext(View& view_, FileSource& fileSource, MapMode mode_, GLContextMode contextMode_, const float pixelRatio_) +MapContext::MapContext(View& view_, FileSource& fileSource_, MapMode mode_, GLContextMode contextMode_, const float pixelRatio_) : view(view_), + fileSource(fileSource_), dataPtr(std::make_unique<MapData>(mode_, contextMode_, pixelRatio_)), data(*dataPtr), asyncUpdate([this] { update(); }), @@ -37,7 +38,6 @@ MapContext::MapContext(View& view_, FileSource& fileSource, MapMode mode_, GLCon texturePool(std::make_unique<gl::TexturePool>()) { assert(util::ThreadContext::currentlyOn(util::ThreadType::Map)); - util::ThreadContext::setFileSource(&fileSource); util::ThreadContext::setGLObjectStore(&glObjectStore); view.activate(); @@ -96,7 +96,7 @@ void MapContext::setStyleURL(const std::string& url) { styleURL = url; styleJSON.clear(); - style = std::make_unique<Style>(data); + style = std::make_unique<Style>(data, fileSource); const size_t pos = styleURL.rfind('/'); std::string base = ""; @@ -104,8 +104,7 @@ void MapContext::setStyleURL(const std::string& url) { base = styleURL.substr(0, pos + 1); } - FileSource* fs = util::ThreadContext::getFileSource(); - styleRequest = fs->request(Resource::style(styleURL), [this, base](Response res) { + styleRequest = fileSource.request(Resource::style(styleURL), [this, base](Response res) { if (res.error) { if (res.error->reason == Response::Error::Reason::NotFound && util::mapbox::isMapboxURL(styleURL)) { @@ -130,7 +129,7 @@ void MapContext::setStyleJSON(const std::string& json, const std::string& base) styleURL.clear(); styleJSON.clear(); - style = std::make_unique<Style>(data); + style = std::make_unique<Style>(data, fileSource); loadStyleJSON(json, base); } |