blob: 8517d6e4a6f08377bcd46353d3c00531f8c43a03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef MBGL_STORAGE_FILE_SOURCE
#define MBGL_STORAGE_FILE_SOURCE
#include "response.hpp"
#include "resource.hpp"
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/util.hpp>
#include <functional>
typedef struct uv_loop_s uv_loop_t;
namespace mbgl {
class Request;
class FileSource : private util::noncopyable {
protected:
MBGL_STORE_THREAD(tid)
public:
virtual ~FileSource() = default;
using Callback = std::function<void(const Response &)>;
// These can be called from any thread. The callback will be invoked in the loop.
// You can only cancel a request from the same thread it was created in.
virtual Request *request(const Resource &resource, uv_loop_t *loop, Callback callback) = 0;
virtual void cancel(Request *request) = 0;
// These can be called from any thread. The callback will be invoked in an arbitrary other thread.
// You cannot cancel these requests.
virtual void request(const Resource &resource, Callback callback) = 0;
};
}
#endif
|