diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-13 17:10:13 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-10 15:40:20 -0800 |
commit | dbb8e58aea00a84716aafa6887b50c0186169f9e (patch) | |
tree | e981b82badcf800d6d33acac94d44a78f7b57776 /include | |
parent | f3d4107d19eef20cc2cf30cd347301128b4f9a86 (diff) | |
download | qtlocation-mapboxgl-dbb8e58aea00a84716aafa6887b50c0186169f9e.tar.gz |
[core] Moving caching logic to DefaultFileSource
This results in OnlineFileSource containing precisely the logic we want for reuse by OfflineFileSource, and no more.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/storage/default_file_source.hpp | 7 | ||||
-rw-r--r-- | include/mbgl/storage/online_file_source.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/storage/resource.hpp | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index bedea25bef..e7f95aa238 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -5,6 +5,8 @@ namespace mbgl { +class SQLiteCache; + class DefaultFileSource : public FileSource { public: DefaultFileSource(const std::string& cachePath, const std::string& assetRoot); @@ -18,8 +20,13 @@ public: std::unique_ptr<FileRequest> request(const Resource&, Callback) override; + // For testing purposes only. + SQLiteCache& getCache(); + private: class Impl; + friend class DefaultFileRequest; + const std::unique_ptr<Impl> impl; }; diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp index bdf14c7b34..1f346b5e76 100644 --- a/include/mbgl/storage/online_file_source.hpp +++ b/include/mbgl/storage/online_file_source.hpp @@ -5,15 +5,13 @@ namespace mbgl { -class SQLiteCache; - namespace util { template <typename T> class Thread; } // namespace util class OnlineFileSource : public FileSource { public: - OnlineFileSource(SQLiteCache*); + OnlineFileSource(); ~OnlineFileSource() override; void setAccessToken(const std::string& t) { accessToken = t; } diff --git a/include/mbgl/storage/resource.hpp b/include/mbgl/storage/resource.hpp index c97384e6a7..4c68e71003 100644 --- a/include/mbgl/storage/resource.hpp +++ b/include/mbgl/storage/resource.hpp @@ -47,8 +47,8 @@ public: static Resource spriteImage(const std::string& base, float pixelRatio); static Resource spriteJSON(const std::string& base, float pixelRatio); - const Kind kind; - const std::string url; + Kind kind; + std::string url; // Includes auxiliary data if this is a tile request. optional<TileData> tileData; |