diff options
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r-- | include/mbgl/storage/base_request.hpp | 8 | ||||
-rw-r--r-- | include/mbgl/storage/file_request.hpp | 5 | ||||
-rw-r--r-- | include/mbgl/storage/file_source.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/storage/http_request.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/storage/request.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/storage/sqlite_store.hpp | 2 |
6 files changed, 12 insertions, 16 deletions
diff --git a/include/mbgl/storage/base_request.hpp b/include/mbgl/storage/base_request.hpp index 05ef1e4a7b..c903742f4b 100644 --- a/include/mbgl/storage/base_request.hpp +++ b/include/mbgl/storage/base_request.hpp @@ -1,11 +1,13 @@ #ifndef MBGL_STORAGE_BASE_REQUEST #define MBGL_STORAGE_BASE_REQUEST +#include <mbgl/util/ptr.hpp> + #include <string> #include <forward_list> -#include <memory> #include <functional> + typedef struct uv_loop_s uv_loop_t; typedef struct uv_async_s uv_async_t; @@ -28,7 +30,7 @@ public: BaseRequest(const std::string &path); virtual ~BaseRequest(); - Callback *add(Callback &&callback, const std::shared_ptr<BaseRequest> &request); + Callback *add(Callback &&callback, const util::ptr<BaseRequest> &request); void remove(Callback *callback); void notify(); @@ -40,7 +42,7 @@ public: private: // This object may hold a shared_ptr to itself. It does this to prevent destruction of this object // while a request is in progress. - std::shared_ptr<BaseRequest> self; + util::ptr<BaseRequest> self; std::forward_list<std::unique_ptr<Callback>> callbacks; }; diff --git a/include/mbgl/storage/file_request.hpp b/include/mbgl/storage/file_request.hpp index 331ed8421f..c99237ad4b 100644 --- a/include/mbgl/storage/file_request.hpp +++ b/include/mbgl/storage/file_request.hpp @@ -1,11 +1,6 @@ #ifndef MBGL_STORAGE_FILE_REQUEST #define MBGL_STORAGE_FILE_REQUEST - -#include <string> -#include <memory> -#include <cassert> - #include <mbgl/storage/base_request.hpp> namespace mbgl { diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp index 4cc95ae24e..06d416d0c6 100644 --- a/include/mbgl/storage/file_source.hpp +++ b/include/mbgl/storage/file_source.hpp @@ -5,7 +5,6 @@ #include <mbgl/storage/request.hpp> #include <string> -#include <memory> #include <unordered_map> #include <functional> @@ -44,7 +43,7 @@ private: std::string base; std::unordered_map<std::string, std::weak_ptr<BaseRequest>> pending; - std::shared_ptr<SQLiteStore> store; + util::ptr<SQLiteStore> store; uv_loop_t *loop = nullptr; uv_messenger_t *queue = nullptr; }; diff --git a/include/mbgl/storage/http_request.hpp b/include/mbgl/storage/http_request.hpp index 30f7b3aa6d..ef3210d48d 100644 --- a/include/mbgl/storage/http_request.hpp +++ b/include/mbgl/storage/http_request.hpp @@ -19,7 +19,7 @@ class SQLiteStore; class HTTPRequest : public BaseRequest { public: - HTTPRequest(ResourceType type, const std::string &path, uv_loop_t *loop, std::shared_ptr<SQLiteStore> store); + HTTPRequest(ResourceType type, const std::string &path, uv_loop_t *loop, util::ptr<SQLiteStore> store); ~HTTPRequest(); private: @@ -29,7 +29,7 @@ private: const unsigned long thread_id; CacheRequestBaton *cache_baton = nullptr; HTTPRequestBaton *http_baton = nullptr; - std::shared_ptr<SQLiteStore> store; + util::ptr<SQLiteStore> store; const ResourceType type; }; diff --git a/include/mbgl/storage/request.hpp b/include/mbgl/storage/request.hpp index fa27fbc781..10c938ed15 100644 --- a/include/mbgl/storage/request.hpp +++ b/include/mbgl/storage/request.hpp @@ -2,8 +2,8 @@ #define MBGL_STORAGE_REQUEST #include <mbgl/storage/response.hpp> +#include <mbgl/util/ptr.hpp> -#include <memory> #include <functional> #include <forward_list> @@ -22,7 +22,7 @@ private: Request& operator=(Request &&) = delete; public: - Request(const std::shared_ptr<BaseRequest> &base); + Request(const util::ptr<BaseRequest> &base); ~Request(); void onload(Callback cb); @@ -30,7 +30,7 @@ public: private: const unsigned long thread_id; - std::shared_ptr<BaseRequest> base; + util::ptr<BaseRequest> base; std::forward_list<Callback *> callbacks; }; diff --git a/include/mbgl/storage/sqlite_store.hpp b/include/mbgl/storage/sqlite_store.hpp index e03e6cf2bc..cb7730d0bf 100644 --- a/include/mbgl/storage/sqlite_store.hpp +++ b/include/mbgl/storage/sqlite_store.hpp @@ -38,7 +38,7 @@ private: private: const unsigned long thread_id; - std::shared_ptr<mapbox::sqlite::Database> db; + util::ptr<mapbox::sqlite::Database> db; uv_worker_t *worker = nullptr; }; |