[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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
struct Resource;
|
||||
class Resource;
|
||||
class Response;
|
||||
class WorkRequest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user