#include #include #include #include #include #include namespace mbgl { FileRequest::FileRequest(const std::string &path_, uv_loop_t *loop) : BaseRequest(path_), ptr(new FileRequestBaton(this, path, loop)) { } void FileRequest::cancel() { assert(uv_thread_self() == threadId); if (ptr) { ptr->cancel(); // When deleting a FileRequest object with a uv_fs_* call is in progress, we are making sure // that the callback doesn't accidentally reference this object again. ptr->request = nullptr; ptr = nullptr; } notify(); } FileRequest::~FileRequest() { assert(uv_thread_self() == threadId); cancel(); } }