diff options
author | Leith Bade <leith@mapbox.com> | 2014-12-18 20:35:55 +1100 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2014-12-18 20:35:55 +1100 |
commit | 1dd3ad8e642775a01925ebfb78d2ea7f362ea385 (patch) | |
tree | bad0e4aa629655e8361fe6928eacf5641aad0b7d /platform/default | |
parent | 465ae587a2ed6169df00b182d51f4f647f23c4f6 (diff) | |
download | qtlocation-mapboxgl-1dd3ad8e642775a01925ebfb78d2ea7f362ea385.tar.gz |
Fix build
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/asset_request_baton_noop.cpp | 22 | ||||
-rw-r--r-- | platform/default/asset_request_libuv.cpp | 24 |
2 files changed, 5 insertions, 41 deletions
diff --git a/platform/default/asset_request_baton_noop.cpp b/platform/default/asset_request_baton_noop.cpp deleted file mode 100644 index 79f69a2daf..0000000000 --- a/platform/default/asset_request_baton_noop.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include <mbgl/mbgl.hpp> -#include <mbgl/storage/asset_request_baton.hpp> -#include <mbgl/storage/response.hpp> - -namespace mbgl { - -void AssetRequestBaton::run(AssetRequestBaton *ptr) { - assert(std::this_thread::get_id() == ptr->threadId); - - if (ptr->canceled || !ptr->request) { - // Either the AssetRequest object has been destructed, or the - // request was canceled. - cleanup(ptr); - return; - } - - // Just return a 500 error until implemented properly - notifyError(ptr, 500, "Assets not implemented on this platform."); - cleanup(ptr); -} - -} diff --git a/platform/default/asset_request_libuv.cpp b/platform/default/asset_request_libuv.cpp index c77bb57de8..0e0b7280a7 100644 --- a/platform/default/asset_request_libuv.cpp +++ b/platform/default/asset_request_libuv.cpp @@ -30,16 +30,8 @@ struct AssetRequestBaton { uv_buf_t buffer; }; -void AssetRequestBaton::run(AssetRequestBaton *ptr) { - assert(std::this_thread::get_id() == ptr->threadId); - - if (ptr->canceled || !ptr->request) { - // Either the AssetRequest object has been destructed, or the - // request was canceled. - cleanup(ptr); - return; - } - +AssetRequestBaton::AssetRequestBaton(AssetRequest *request_, const std::string &path, uv_loop_t *loop) + : threadId(std::this_thread::get_id()), request(request_) { req.data = this; uv_fs_open(loop, &req, path.c_str(), O_RDONLY, S_IRUSR, fileOpened); } @@ -56,17 +48,11 @@ void AssetRequestBaton::cancel() { uv_cancel((uv_req_t *)&req); } -void AssetRequestBaton::run(AssetRequestBaton *ptr) { +void AssetRequestBaton::notifyError(uv_fs_t *req) { + AssetRequestBaton *ptr = reinterpret_cast<AssetRequestBaton *>(req->data); assert(std::this_thread::get_id() == ptr->threadId); - if (ptr->canceled || !ptr->request) { - // Either the AssetRequest object has been destructed, or the - // request was canceled. - cleanup(ptr); - return; - } - - rf (ptr->request && req->result < 0 && !ptr->canceled && req->result != UV_ECANCELED) { + if (ptr->request && req->result < 0 && !ptr->canceled && req->result != UV_ECANCELED) { ptr->request->response = util::make_unique<Response>(); ptr->request->response->code = req->result == UV_ENOENT ? 404 : 500; #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 |