diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-13 14:32:21 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-22 18:42:53 -0800 |
commit | a877b9b192fb199b8ec6379551b3fb81e13d673d (patch) | |
tree | 8ad116b7966ece0c3e51da3fca9732ea266e2551 /src | |
parent | 27134df2e40efa14928859bface3de0bc2819072 (diff) | |
download | qtlocation-mapboxgl-a877b9b192fb199b8ec6379551b3fb81e13d673d.tar.gz |
[core] Include prior values of caching headers in Resource
This allows the FileSource interface itself to support revalidation. We could (and probably should) now rewrite HTTPContextBase implementations as FileSource implementations.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/storage/http_context_base.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/storage/http_request_base.hpp | 14 | ||||
-rw-r--r-- | src/mbgl/storage/sqlite_cache.hpp | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/src/mbgl/storage/http_context_base.hpp b/src/mbgl/storage/http_context_base.hpp index a1a3f5b597..b50bf11ec7 100644 --- a/src/mbgl/storage/http_context_base.hpp +++ b/src/mbgl/storage/http_context_base.hpp @@ -13,9 +13,7 @@ public: static std::unique_ptr<HTTPContextBase> createContext(); virtual ~HTTPContextBase() = default; - virtual HTTPRequestBase* createRequest(const std::string& url, - HTTPRequestBase::Callback, - std::shared_ptr<const Response>) = 0; + virtual HTTPRequestBase* createRequest(const Resource&, HTTPRequestBase::Callback) = 0; }; } // namespace mbgl diff --git a/src/mbgl/storage/http_request_base.hpp b/src/mbgl/storage/http_request_base.hpp index 1a8cf73da6..37a0b4d091 100644 --- a/src/mbgl/storage/http_request_base.hpp +++ b/src/mbgl/storage/http_request_base.hpp @@ -1,14 +1,14 @@ #ifndef MBGL_STORAGE_HTTP_REQUEST_BASE #define MBGL_STORAGE_HTTP_REQUEST_BASE +#include <mbgl/storage/response.hpp> +#include <mbgl/storage/resource.hpp> + #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/chrono.hpp> #include <mbgl/util/optional.hpp> -#include <memory> #include <functional> -#include <utility> -#include <string> namespace mbgl { @@ -16,10 +16,10 @@ class Response; class HTTPRequestBase : private util::noncopyable { public: - using Callback = std::function<void (std::shared_ptr<const Response> response)>; + using Callback = std::function<void (Response)>; - HTTPRequestBase(const std::string& url_, Callback notify_) - : url(url_) + HTTPRequestBase(const Resource& resource_, Callback notify_) + : resource(resource_) , notify(std::move(notify_)) , cancelled(false) { } @@ -30,7 +30,7 @@ public: protected: static optional<SystemTimePoint> parseCacheControl(const char *value); - std::string url; + Resource resource; Callback notify; bool cancelled; }; diff --git a/src/mbgl/storage/sqlite_cache.hpp b/src/mbgl/storage/sqlite_cache.hpp index 64c683f4ef..b5a7cbcc07 100644 --- a/src/mbgl/storage/sqlite_cache.hpp +++ b/src/mbgl/storage/sqlite_cache.hpp @@ -10,7 +10,7 @@ namespace mbgl { -struct Resource; +class Resource; class Response; class WorkRequest; |