summaryrefslogtreecommitdiff
path: root/src/mbgl/storage/file_request_baton.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/storage/file_request_baton.hpp')
-rw-r--r--src/mbgl/storage/file_request_baton.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mbgl/storage/file_request_baton.hpp b/src/mbgl/storage/file_request_baton.hpp
new file mode 100644
index 0000000000..897c88061d
--- /dev/null
+++ b/src/mbgl/storage/file_request_baton.hpp
@@ -0,0 +1,36 @@
+#ifndef MBGL_STORAGE_FILE_REQUEST_BATON
+#define MBGL_STORAGE_FILE_REQUEST_BATON
+
+#include <mbgl/storage/file_request.hpp>
+#include <thread>
+
+#include <uv.h>
+
+namespace mbgl {
+
+struct FileRequestBaton {
+ FileRequestBaton(FileRequest *request_, const std::string &path, uv_loop_t *loop);
+ ~FileRequestBaton();
+
+ void cancel();
+ static void file_opened(uv_fs_t *req);
+ static void file_stated(uv_fs_t *req);
+ static void file_read(uv_fs_t *req);
+ static void file_closed(uv_fs_t *req);
+ static void notify_error(uv_fs_t *req);
+ static void cleanup(uv_fs_t *req);
+
+ const std::thread::id thread_id;
+ FileRequest *request = nullptr;
+ uv_fs_t req;
+ uv_file fd = -1;
+ bool canceled = false;
+ std::string body;
+ uv_buf_t buffer;
+};
+
+
+}
+
+
+#endif