diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-01 08:48:11 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-06 16:01:59 +0300 |
commit | ec1b4c43fd711b7f4f924a21e8428868d7a5f78d (patch) | |
tree | 7e9c24eb96bf3f36d4d3d8548b31699403247f12 /src | |
parent | f6b8dd4be9677bae18f3d6e50ee706cc3693b933 (diff) | |
download | qtlocation-mapboxgl-ec1b4c43fd711b7f4f924a21e8428868d7a5f78d.tar.gz |
Do not force uv_loop_t as the first parameter for a threaded object ctor
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map_context.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/map/map_context.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/storage/default_file_source.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/storage/default_file_source_impl.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/util/thread.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/util/worker.cpp | 2 |
6 files changed, 10 insertions, 14 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index b4bebb4f6b..f6dba408da 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -26,11 +26,11 @@ namespace mbgl { -MapContext::MapContext(uv_loop_t* loop, View& view_, FileSource& fileSource, MapData& data_) +MapContext::MapContext(View& view_, FileSource& fileSource, MapData& data_) : view(view_), data(data_), updated(static_cast<UpdateType>(Update::Nothing)), - asyncUpdate(std::make_unique<uv::async>(loop, [this] { update(); })), + asyncUpdate(std::make_unique<uv::async>(util::RunLoop::getLoop(), [this] { update(); })), texturePool(std::make_unique<TexturePool>()) { assert(util::ThreadContext::currentlyOn(util::ThreadType::Map)); diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp index 141a8ee964..724920b825 100644 --- a/src/mbgl/map/map_context.hpp +++ b/src/mbgl/map/map_context.hpp @@ -10,8 +10,6 @@ #include <vector> -typedef struct uv_loop_s uv_loop_t; - namespace uv { class async; } @@ -30,7 +28,7 @@ struct LatLngBounds; class MapContext : public Style::Observer { public: - MapContext(uv_loop_t*, View&, FileSource&, MapData&); + MapContext(View&, FileSource&, MapData&); ~MapContext(); struct RenderResult { diff --git a/src/mbgl/storage/default_file_source.cpp b/src/mbgl/storage/default_file_source.cpp index 5f6bdcb6ac..a9908c450a 100644 --- a/src/mbgl/storage/default_file_source.cpp +++ b/src/mbgl/storage/default_file_source.cpp @@ -71,12 +71,12 @@ void DefaultFileSource::cancel(Request *req) { // ----- Impl ----- -DefaultFileSource::Impl::Impl(uv_loop_t* loop_, FileCache* cache_, const std::string& root) - : loop(loop_), +DefaultFileSource::Impl::Impl(FileCache* cache_, const std::string& root) + : loop(util::RunLoop::getLoop()), cache(cache_), assetRoot(root.empty() ? platform::assetRoot() : root), - assetContext(AssetContext::createContext(loop_)), - httpContext(HTTPContext::createContext(loop_)) { + assetContext(AssetContext::createContext(loop)), + httpContext(HTTPContext::createContext(loop)) { } DefaultFileRequest* DefaultFileSource::Impl::find(const Resource& resource) { diff --git a/src/mbgl/storage/default_file_source_impl.hpp b/src/mbgl/storage/default_file_source_impl.hpp index 22ca5b6d15..06fe3e39b7 100644 --- a/src/mbgl/storage/default_file_source_impl.hpp +++ b/src/mbgl/storage/default_file_source_impl.hpp @@ -8,8 +8,6 @@ #include <set> #include <unordered_map> -typedef struct uv_loop_s uv_loop_t; - namespace mbgl { class RequestBase; @@ -33,7 +31,7 @@ struct DefaultFileRequest { class DefaultFileSource::Impl { public: - Impl(uv_loop_t*, FileCache*, const std::string& = ""); + Impl(FileCache*, const std::string& = ""); void add(Request*); void cancel(Request*); diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 88a709cfa6..b6eb48dfb6 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -118,7 +118,7 @@ void Thread<Object>::run(ThreadContext context, P&& params, std::index_sequence< RunLoop loop_(l.get()); loop = &loop_; - Object object_(l.get(), std::get<I>(std::forward<P>(params))...); + Object object_(std::get<I>(std::forward<P>(params))...); object = &object_; running.set_value(); diff --git a/src/mbgl/util/worker.cpp b/src/mbgl/util/worker.cpp index 9277dacccf..1ab6d766f4 100644 --- a/src/mbgl/util/worker.cpp +++ b/src/mbgl/util/worker.cpp @@ -14,7 +14,7 @@ namespace mbgl { class Worker::Impl { public: - Impl(uv_loop_t*, FileSource* fs) { + Impl(FileSource* fs) { // FIXME: Workers should not access the FileSource but it // is currently needed because of GlyphsPBF. See #1664. util::ThreadContext::setFileSource(fs); |