summaryrefslogtreecommitdiff
path: root/include/mbgl/map/map.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-03-04 12:32:14 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-03-06 08:21:47 -0800
commit9781785ab73e8394e8b92625cc4741952f47955d (patch)
tree1b9e6b86c1c9ca19bb1bf1c52bcd0e41410ced66 /include/mbgl/map/map.hpp
parent8c0acecbe362be4a40638491b67ee5fe3d23a65e (diff)
downloadqtlocation-mapboxgl-9781785ab73e8394e8b92625cc4741952f47955d.tar.gz
scope Requests to an Environment object for easier cancelation
we are now scoping all file requests to an environment object. The FileSource implementation treats this as an opaque pointer, but allows canceling all Requests that are associated with that pointer. This is necessary to abort all file requests that originated from a particular Map object. Aborting a file request is different from canceling a file request: A canceled request doesn't have its callback called, while an aborted request will have its callback called with an error, indicating that the environment is going to be shut down.
Diffstat (limited to 'include/mbgl/map/map.hpp')
-rw-r--r--include/mbgl/map/map.hpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 8711aa3d08..00719aa382 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -36,11 +36,7 @@ class View;
class GlyphAtlas;
class SpriteAtlas;
class LineAtlas;
-
-struct exception : std::runtime_error {
- inline exception(const char *msg) : std::runtime_error(msg) {
- }
-};
+class Environment;
class Map : private util::noncopyable {
friend class View;
@@ -182,8 +178,8 @@ private:
Mode mode = Mode::None;
-public: // TODO: make private again
- std::unique_ptr<uv::loop> loop;
+ const std::unique_ptr<Environment> env;
+ View &view;
private:
std::unique_ptr<uv::worker> workers;
@@ -214,12 +210,8 @@ private:
// Stores whether the map thread has been stopped already.
std::atomic_bool isStopped;
- View &view;
-
-#ifdef DEBUG
const std::thread::id mainThread;
std::thread::id mapThread;
-#endif
Transform transform;
TransformState state;