summaryrefslogtreecommitdiff
path: root/platform/default
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-29 17:49:22 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-10 15:40:20 -0800
commit025375ad0b365a06e0742b92fecc9bc538b5a6e0 (patch)
treed94054813001e7b64c57d09651a47084064f9372 /platform/default
parentdbb8e58aea00a84716aafa6887b50c0186169f9e (diff)
downloadqtlocation-mapboxgl-025375ad0b365a06e0742b92fecc9bc538b5a6e0.tar.gz
[core] Cache with mapbox:// tile URLs
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/online_file_source.cpp6
-rw-r--r--platform/default/sqlite_cache.cpp11
2 files changed, 9 insertions, 8 deletions
diff --git a/platform/default/online_file_source.cpp b/platform/default/online_file_source.cpp
index 938c29d095..01dc23bae0 100644
--- a/platform/default/online_file_source.cpp
+++ b/platform/default/online_file_source.cpp
@@ -92,6 +92,9 @@ std::unique_ptr<FileRequest> OnlineFileSource::request(const Resource& resource,
Resource res = resource;
switch (resource.kind) {
+ case Resource::Kind::Unknown:
+ break;
+
case Resource::Kind::Style:
res.url = mbgl::util::mapbox::normalizeStyleURL(resource.url, accessToken);
break;
@@ -109,7 +112,8 @@ std::unique_ptr<FileRequest> OnlineFileSource::request(const Resource& resource,
res.url = util::mapbox::normalizeSpriteURL(resource.url, accessToken);
break;
- default:
+ case Resource::Kind::Tile:
+ res.url = util::mapbox::normalizeTileURL(resource.url, accessToken);
break;
}
diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp
index 1980b3dead..b3f528ac92 100644
--- a/platform/default/sqlite_cache.cpp
+++ b/platform/default/sqlite_cache.cpp
@@ -322,8 +322,7 @@ void SQLiteCache::Impl::get(const Resource &resource, Callback callback) {
getStmt->reset();
}
- const auto canonicalURL = util::mapbox::canonicalURL(resource.url);
- getStmt->bind(1, canonicalURL.c_str());
+ getStmt->bind(1, resource.url);
if (getStmt->run()) {
// There is data.
auto response = std::make_unique<Response>();
@@ -358,7 +357,7 @@ void SQLiteCache::Impl::get(const Resource &resource, Callback callback) {
}
accessedStmt->bind(1, SystemClock::now());
- accessedStmt->bind(2, canonicalURL.c_str());
+ accessedStmt->bind(2, resource.url);
accessedStmt->run();
}
} catch (mapbox::sqlite::Exception& ex) {
@@ -411,8 +410,7 @@ void SQLiteCache::Impl::put(const Resource& resource, const Response& response)
putStmt->reset();
}
- const auto canonicalURL = util::mapbox::canonicalURL(resource.url);
- putStmt->bind(1 /* url */, canonicalURL.c_str());
+ putStmt->bind(1 /* url */, resource.url);
if (response.error) {
putStmt->bind(2 /* status */, int(response.error->reason));
} else {
@@ -465,10 +463,9 @@ void SQLiteCache::Impl::refresh(const Resource& resource, optional<SystemTimePoi
refreshStmt->reset();
}
- const auto canonicalURL = util::mapbox::canonicalURL(resource.url);
refreshStmt->bind(1, SystemClock::now());
refreshStmt->bind(2, expires);
- refreshStmt->bind(3, canonicalURL.c_str());
+ refreshStmt->bind(3, resource.url);
refreshStmt->run();
} catch (mapbox::sqlite::Exception& ex) {
Log::Error(Event::Database, ex.code, ex.what());