summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-11 17:20:07 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-14 13:46:03 -0800
commit7fb5e973edbf546046defb67dd28f1275326319b (patch)
tree39240ab154af6919e15e6b1ebf52ed44f6cd6b99 /platform
parentf9574e350c9634b5a4f9849fdfe66fbd84747b12 (diff)
downloadqtlocation-mapboxgl-7fb5e973edbf546046defb67dd28f1275326319b.tar.gz
[core] Eliminate FileCache interface
There is only one implementation and we're unlikely to add more.
Diffstat (limited to 'platform')
-rw-r--r--platform/default/online_file_source.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/default/online_file_source.cpp b/platform/default/online_file_source.cpp
index 330ecba091..30f3701d2d 100644
--- a/platform/default/online_file_source.cpp
+++ b/platform/default/online_file_source.cpp
@@ -1,6 +1,7 @@
#include <mbgl/storage/online_file_source.hpp>
#include <mbgl/storage/http_context_base.hpp>
#include <mbgl/storage/network_status.hpp>
+#include <mbgl/storage/sqlite_cache.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/platform/log.hpp>
@@ -68,7 +69,7 @@ class OnlineFileSource::Impl {
public:
using Callback = std::function<void (Response)>;
- Impl(FileCache*);
+ Impl(SQLiteCache*);
~Impl();
void networkIsReachableAgain();
@@ -80,12 +81,12 @@ private:
friend OnlineFileRequestImpl;
std::unordered_map<FileRequest*, std::unique_ptr<OnlineFileRequestImpl>> pending;
- FileCache* const cache;
+ SQLiteCache* const cache;
const std::unique_ptr<HTTPContextBase> httpContext;
util::AsyncTask reachability;
};
-OnlineFileSource::OnlineFileSource(FileCache* cache)
+OnlineFileSource::OnlineFileSource(SQLiteCache* cache)
: thread(std::make_unique<util::Thread<Impl>>(
util::ThreadContext{ "OnlineFileSource", util::ThreadType::Unknown, util::ThreadPriority::Low },
cache)) {
@@ -134,7 +135,7 @@ void OnlineFileSource::cancel(FileRequest* req) {
// ----- Impl -----
-OnlineFileSource::Impl::Impl(FileCache* cache_)
+OnlineFileSource::Impl::Impl(SQLiteCache* cache_)
: cache(cache_),
httpContext(HTTPContextBase::createContext()),
reachability(std::bind(&Impl::networkIsReachableAgain, this)) {
@@ -251,9 +252,9 @@ void OnlineFileRequestImpl::scheduleRealRequest(OnlineFileSource::Impl& impl, bo
(!response_->error || (response_->error->reason == Response::Error::Reason::NotFound))) {
// Store response in database. Make sure we only refresh the expires column if the data
// didn't change.
- FileCache::Hint hint = FileCache::Hint::Full;
+ SQLiteCache::Hint hint = SQLiteCache::Hint::Full;
if (response && response_->data == response->data) {
- hint = FileCache::Hint::Refresh;
+ hint = SQLiteCache::Hint::Refresh;
}
impl.cache->put(resource, response_, hint);
}