diff options
Diffstat (limited to 'src/mbgl/storage/default_file_source.cpp')
-rw-r--r-- | src/mbgl/storage/default_file_source.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mbgl/storage/default_file_source.cpp b/src/mbgl/storage/default_file_source.cpp index 439acd8888..63a0e329fb 100644 --- a/src/mbgl/storage/default_file_source.cpp +++ b/src/mbgl/storage/default_file_source.cpp @@ -78,21 +78,20 @@ void DefaultFileSource::cancel(const Resource& res, FileRequest* req) { // ----- Impl ----- DefaultFileSource::Impl::Impl(FileCache* cache_, const std::string& root) - : loop(reinterpret_cast<uv_loop_t*>(util::RunLoop::getLoopHandle())), - cache(cache_), + : cache(cache_), assetRoot(root.empty() ? platform::assetRoot() : root), - assetContext(AssetContextBase::createContext(loop)), - httpContext(HTTPContextBase::createContext(loop)), - reachability(std::make_unique<uv::async>(loop, std::bind(&Impl::networkIsReachableAgain, this))) { + assetContext(AssetContextBase::createContext()), + httpContext(HTTPContextBase::createContext()), + reachability(std::bind(&Impl::networkIsReachableAgain, this)) { // Subscribe to network status changes, but make sure that this async handle doesn't keep the // loop alive; otherwise our app wouldn't terminate. After all, we only need status change // notifications when our app is still running. - NetworkStatus::Subscribe(reachability->get()); - reachability->unref(); + NetworkStatus::Subscribe(&reachability); + reachability.unref(); } DefaultFileSource::Impl::~Impl() { - NetworkStatus::Unsubscribe(reachability->get()); + NetworkStatus::Unsubscribe(&reachability); } void DefaultFileSource::Impl::networkIsReachableAgain() { @@ -202,10 +201,10 @@ void DefaultFileSource::Impl::startRealRequest(DefaultFileRequestImpl& request) if (algo::starts_with(request.resource.url, "asset://")) { request.realRequest = - assetContext->createRequest(request.resource, callback, loop, assetRoot); + assetContext->createRequest(request.resource, callback, assetRoot); } else { request.realRequest = - httpContext->createRequest(request.resource, callback, loop, request.getResponse()); + httpContext->createRequest(request.resource, callback, request.getResponse()); } } |