summaryrefslogtreecommitdiff
path: root/platform/glfw/main.cpp
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-04-03 15:08:02 +0300
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-04-29 17:09:58 +0300
commit2604991b2b0090ed69893f6b156a6e640a789c9f (patch)
treed6b29f0a512b3de53fb4cc23d96cc2f52b1fdffe /platform/glfw/main.cpp
parent4c8295e67200e15979ddc0c6b16d9b09e4f0a192 (diff)
downloadqtlocation-mapboxgl-2604991b2b0090ed69893f6b156a6e640a789c9f.tar.gz
[core] Introduce resetCache API
Add an API to delete existing database and re-initialize.
Diffstat (limited to 'platform/glfw/main.cpp')
-rw-r--r--platform/glfw/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp
index 0a4ace6a19..4e631ec895 100644
--- a/platform/glfw/main.cpp
+++ b/platform/glfw/main.cpp
@@ -6,6 +6,7 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/util/default_thread_pool.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/renderer/renderer.hpp>
@@ -159,6 +160,14 @@ int main(int argc, char *argv[]) {
isPaused = !isPaused;
});
+ view->setResetCacheCallback([fileSource] () {
+ fileSource->resetCache([](std::exception_ptr ex) {
+ if (ex) {
+ mbgl::Log::Error(mbgl::Event::Database, "Failed to reset cache:: %s", mbgl::util::toString(ex).c_str());
+ }
+ });
+ });
+
// Load style
if (style.empty()) {
const char *url = getenv("MAPBOX_STYLE_URL");