diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-04-13 18:28:18 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-04-13 18:28:18 +0200 |
commit | 452d12e6e653d61c2182f4464d4365f0b96c9739 (patch) | |
tree | a96bcdba373ca23d832364d7bce6b5912864c1f5 | |
parent | 16849a341b72c0633be1e3c89498c883d6efb000 (diff) | |
download | qtlocation-mapboxgl-452d12e6e653d61c2182f4464d4365f0b96c9739.tar.gz |
make implementation files private headers
30 files changed, 70 insertions, 24 deletions
diff --git a/bin/render.cpp b/bin/render.cpp index 01f6929092..440256b38c 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -7,7 +7,7 @@ #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #pragma GCC diagnostic push #ifndef __clang__ diff --git a/gyp/asset-fs.gypi b/gyp/asset-fs.gypi index f8ec0e3558..f7fbea1c78 100644 --- a/gyp/asset-fs.gypi +++ b/gyp/asset-fs.gypi @@ -12,6 +12,7 @@ 'include_dirs': [ '../include', + '../src', ], 'variables': { diff --git a/gyp/asset-zip.gypi b/gyp/asset-zip.gypi index 5c57aa18b5..8a195649f3 100644 --- a/gyp/asset-zip.gypi +++ b/gyp/asset-zip.gypi @@ -13,6 +13,7 @@ 'include_dirs': [ '../include', + '../src', ], 'variables': { diff --git a/gyp/http-curl.gypi b/gyp/http-curl.gypi index c97ad370b5..b7c5832359 100644 --- a/gyp/http-curl.gypi +++ b/gyp/http-curl.gypi @@ -12,6 +12,7 @@ 'include_dirs': [ '../include', + '../src', ], 'variables': { diff --git a/gyp/http-nsurl.gypi b/gyp/http-nsurl.gypi index 5a079fdeeb..a64c8508e8 100644 --- a/gyp/http-nsurl.gypi +++ b/gyp/http-nsurl.gypi @@ -12,6 +12,7 @@ 'include_dirs': [ '../include', + '../src', ], 'variables': { diff --git a/include/mbgl/android/native_map_view.hpp b/include/mbgl/android/native_map_view.hpp index 21784f5315..14ccaba3f7 100644 --- a/include/mbgl/android/native_map_view.hpp +++ b/include/mbgl/android/native_map_view.hpp @@ -4,7 +4,7 @@ #include <mbgl/map/map.hpp> #include <mbgl/map/view.hpp> #include <mbgl/util/noncopyable.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/storage/default_file_source.hpp> #include <string> diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index 372dee909b..f393747168 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -3,10 +3,13 @@ #include <mbgl/storage/file_source.hpp> #include <mbgl/storage/file_cache.hpp> -#include <mbgl/util/run_loop.hpp> namespace mbgl { +namespace util { +template <typename T> class Thread; +} + class DefaultFileSource : public FileSource { public: DefaultFileSource(FileCache *cache, const std::string &root = ""); diff --git a/include/mbgl/storage/default/sqlite_cache.hpp b/include/mbgl/storage/sqlite_cache.hpp index db672b222b..db672b222b 100644 --- a/include/mbgl/storage/default/sqlite_cache.hpp +++ b/include/mbgl/storage/sqlite_cache.hpp diff --git a/linux/main.cpp b/linux/main.cpp index 4d5474c02f..6afa3f7f6c 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -6,7 +6,7 @@ #include <mbgl/platform/default/settings_json.hpp> #include <mbgl/platform/default/glfw_view.hpp> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #include <signal.h> #include <getopt.h> diff --git a/macosx/main.mm b/macosx/main.mm index 087544f7c4..add7631893 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -4,7 +4,7 @@ #include <mbgl/platform/darwin/Reachability.h> #include <mbgl/platform/default/glfw_view.hpp> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/geo.hpp> diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm index bd28234767..0fd4a4e8f6 100644 --- a/platform/darwin/http_request_nsurl.mm +++ b/platform/darwin/http_request_nsurl.mm @@ -1,5 +1,5 @@ -#include <mbgl/storage/default/http_request.hpp> -#include <mbgl/storage/default/http_context.hpp> +#include <mbgl/storage/http_request.hpp> +#include <mbgl/storage/http_context.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/uv.hpp> diff --git a/platform/default/asset_request_fs.cpp b/platform/default/asset_request_fs.cpp index d2b07e0a2f..a7d813b720 100644 --- a/platform/default/asset_request_fs.cpp +++ b/platform/default/asset_request_fs.cpp @@ -1,4 +1,4 @@ -#include <mbgl/storage/default/asset_request.hpp> +#include <mbgl/storage/asset_request.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/std.hpp> #include <mbgl/util/util.hpp> diff --git a/platform/default/asset_request_zip.cpp b/platform/default/asset_request_zip.cpp index 10a73b99a9..22d426c762 100644 --- a/platform/default/asset_request_zip.cpp +++ b/platform/default/asset_request_zip.cpp @@ -1,5 +1,5 @@ -#include <mbgl/storage/default/asset_request.hpp> -#include <mbgl/storage/default/thread_context.hpp> +#include <mbgl/storage/asset_request.hpp> +#include <mbgl/storage/thread_context.hpp> #include <mbgl/android/jni.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/platform/log.hpp> diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index e13ccbfb21..1672c9cdb4 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -1,5 +1,5 @@ -#include <mbgl/storage/default/http_request.hpp> -#include <mbgl/storage/default/http_context.hpp> +#include <mbgl/storage/http_request.hpp> +#include <mbgl/storage/http_context.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/platform/log.hpp> diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp index 94a8f072ca..fcd6c09be2 100644 --- a/platform/default/sqlite_cache.cpp +++ b/platform/default/sqlite_cache.cpp @@ -1,5 +1,5 @@ -#include <mbgl/storage/default/sqlite_cache.hpp> -#include <mbgl/storage/default/request.hpp> +#include <mbgl/storage/sqlite_cache.hpp> +#include <mbgl/storage/request.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/compression.hpp> diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index f70f9f348f..68fae64fac 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -11,7 +11,7 @@ #include <mbgl/platform/platform.hpp> #include <mbgl/platform/darwin/reachability.h> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/storage/network_status.hpp> #include <mbgl/util/geo.hpp> diff --git a/include/mbgl/storage/default/asset_request.hpp b/src/mbgl/storage/asset_request.hpp index 48d421c3be..48d421c3be 100644 --- a/include/mbgl/storage/default/asset_request.hpp +++ b/src/mbgl/storage/asset_request.hpp diff --git a/src/mbgl/storage/default_file_source.cpp b/src/mbgl/storage/default_file_source.cpp index ee4042459b..b28e096414 100644 --- a/src/mbgl/storage/default_file_source.cpp +++ b/src/mbgl/storage/default_file_source.cpp @@ -1,7 +1,7 @@ #include <mbgl/storage/default_file_source_impl.hpp> -#include <mbgl/storage/default/request.hpp> -#include <mbgl/storage/default/asset_request.hpp> -#include <mbgl/storage/default/http_request.hpp> +#include <mbgl/storage/request.hpp> +#include <mbgl/storage/asset_request.hpp> +#include <mbgl/storage/http_request.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/platform/platform.hpp> @@ -9,7 +9,6 @@ #include <mbgl/util/uv_detail.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/thread.hpp> -#include <mbgl/util/run_loop.hpp> #include <mbgl/platform/log.hpp> #pragma GCC diagnostic push diff --git a/src/mbgl/storage/default_file_source_impl.hpp b/src/mbgl/storage/default_file_source_impl.hpp new file mode 100644 index 0000000000..82a3b9a1a0 --- /dev/null +++ b/src/mbgl/storage/default_file_source_impl.hpp @@ -0,0 +1,40 @@ +#ifndef MBGL_STORAGE_DEFAULT_DEFAULT_FILE_SOURCE_IMPL +#define MBGL_STORAGE_DEFAULT_DEFAULT_FILE_SOURCE_IMPL + +#include <mbgl/storage/default_file_source.hpp> +#include <mbgl/util/run_loop.hpp> + +#include <set> +#include <unordered_map> + +namespace mbgl { + +class SharedRequestBase; + +class DefaultFileSource::Impl : public util::RunLoop { + friend class util::Thread<DefaultFileSource::Impl>; + +public: + Impl(FileCache *cache, const std::string &root = ""); + +public: + void notify(SharedRequestBase *sharedRequest, const std::set<Request *> &observers, + std::shared_ptr<const Response> response, FileCache::Hint hint); + SharedRequestBase *find(const Resource &resource); + + void processAdd(Request* request); + void processCancel(Request* request); + void processResult(const Resource& resource, std::shared_ptr<const Response> response); + void processAbort(const Environment& env); + +public: + const std::string assetRoot; + +private: + std::unordered_map<Resource, SharedRequestBase *, Resource::Hash> pending; + FileCache *cache = nullptr; +}; + +} + +#endif diff --git a/include/mbgl/storage/default/http_context.hpp b/src/mbgl/storage/http_context.hpp index 6b9518dab3..6b9518dab3 100644 --- a/include/mbgl/storage/default/http_context.hpp +++ b/src/mbgl/storage/http_context.hpp diff --git a/include/mbgl/storage/default/http_request.hpp b/src/mbgl/storage/http_request.hpp index 54e9a77ef0..54e9a77ef0 100644 --- a/include/mbgl/storage/default/http_request.hpp +++ b/src/mbgl/storage/http_request.hpp diff --git a/src/mbgl/storage/request.cpp b/src/mbgl/storage/request.cpp index ed7f625e86..ea80e59503 100644 --- a/src/mbgl/storage/request.cpp +++ b/src/mbgl/storage/request.cpp @@ -1,4 +1,4 @@ -#include <mbgl/storage/default/request.hpp> +#include <mbgl/storage/request.hpp> #include <mbgl/storage/response.hpp> diff --git a/include/mbgl/storage/default/request.hpp b/src/mbgl/storage/request.hpp index 00157329be..00157329be 100644 --- a/include/mbgl/storage/default/request.hpp +++ b/src/mbgl/storage/request.hpp diff --git a/include/mbgl/storage/default/shared_request_base.hpp b/src/mbgl/storage/shared_request_base.hpp index efc78f603d..d7ed00264a 100644 --- a/include/mbgl/storage/default/shared_request_base.hpp +++ b/src/mbgl/storage/shared_request_base.hpp @@ -4,7 +4,7 @@ #include <mbgl/storage/resource.hpp> #include <mbgl/storage/file_cache.hpp> #include <mbgl/storage/default_file_source_impl.hpp> -#include <mbgl/storage/default/request.hpp> +#include <mbgl/storage/request.hpp> #include <mbgl/util/util.hpp> #include <mbgl/util/noncopyable.hpp> diff --git a/include/mbgl/storage/default/thread_context.hpp b/src/mbgl/storage/thread_context.hpp index 763c83a25b..763c83a25b 100644 --- a/include/mbgl/storage/default/thread_context.hpp +++ b/src/mbgl/storage/thread_context.hpp diff --git a/include/mbgl/util/run_loop.hpp b/src/mbgl/util/run_loop.hpp index 9bed417c38..9bed417c38 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/src/mbgl/util/run_loop.hpp diff --git a/include/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 7c9ba70e11..7c9ba70e11 100644 --- a/include/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp diff --git a/test/storage/cache_response.cpp b/test/storage/cache_response.cpp index e37899a86f..d5dd8b36ea 100644 --- a/test/storage/cache_response.cpp +++ b/test/storage/cache_response.cpp @@ -3,7 +3,7 @@ #include <uv.h> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> TEST_F(Storage, CacheResponse) { SCOPED_TEST(CacheResponse); diff --git a/test/storage/cache_revalidate.cpp b/test/storage/cache_revalidate.cpp index bd32042b94..ceb6b29696 100644 --- a/test/storage/cache_revalidate.cpp +++ b/test/storage/cache_revalidate.cpp @@ -3,7 +3,7 @@ #include <uv.h> #include <mbgl/storage/default_file_source.hpp> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> TEST_F(Storage, CacheRevalidate) { SCOPED_TEST(CacheRevalidateSame) diff --git a/test/storage/database.cpp b/test/storage/database.cpp index 02b25d696a..5498dd3892 100644 --- a/test/storage/database.cpp +++ b/test/storage/database.cpp @@ -3,7 +3,7 @@ #include <future> -#include <mbgl/storage/default/sqlite_cache.hpp> +#include <mbgl/storage/sqlite_cache.hpp> #include <mbgl/storage/resource.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/io.hpp> |