summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2019-06-14 15:03:13 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-06-18 16:26:51 +0300
commit59e7b9a8780e282cf90ede7ae8e3b1affe1e684e (patch)
treee5f7fd8a74f4a9495d872acdcdf4eb2b44f123f2
parent9beb740fb747e721b6a678bbe63399c70e132881 (diff)
downloadqtlocation-mapboxgl-59e7b9a8780e282cf90ede7ae8e3b1affe1e684e.tar.gz
[core] Rename resetCache to resetDatabase
Avoid confusion about what is being reset. In this case, the whole database and not only the ambient cache.
-rw-r--r--include/mbgl/storage/default_file_source.hpp2
-rw-r--r--platform/default/include/mbgl/storage/offline_database.hpp2
-rw-r--r--platform/default/src/mbgl/storage/default_file_source.cpp8
-rw-r--r--platform/default/src/mbgl/storage/offline_database.cpp2
-rw-r--r--platform/glfw/glfw_view.cpp2
-rw-r--r--platform/glfw/glfw_view.hpp4
-rw-r--r--platform/glfw/main.cpp2
-rw-r--r--test/storage/offline_database.test.cpp6
8 files changed, 14 insertions, 14 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index 130f4f1022..6a63007a96 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -192,7 +192,7 @@ public:
* executed on the database thread; it is the responsibility of the SDK bindings
* to re-execute a user-provided callback on the main thread.
*/
- void resetCache(std::function<void (std::exception_ptr)>);
+ void resetDatabase(std::function<void (std::exception_ptr)>);
/*
* Forces revalidation of tiles in the ambient cache.
diff --git a/platform/default/include/mbgl/storage/offline_database.hpp b/platform/default/include/mbgl/storage/offline_database.hpp
index 4e9ffcf028..f9c03dc35d 100644
--- a/platform/default/include/mbgl/storage/offline_database.hpp
+++ b/platform/default/include/mbgl/storage/offline_database.hpp
@@ -44,7 +44,7 @@ public:
~OfflineDatabase();
void changePath(const std::string&);
- std::exception_ptr resetCache();
+ std::exception_ptr resetDatabase();
optional<Response> get(const Resource&);
diff --git a/platform/default/src/mbgl/storage/default_file_source.cpp b/platform/default/src/mbgl/storage/default_file_source.cpp
index 92e86b25d0..0f786f3868 100644
--- a/platform/default/src/mbgl/storage/default_file_source.cpp
+++ b/platform/default/src/mbgl/storage/default_file_source.cpp
@@ -184,8 +184,8 @@ public:
offlineDatabase->put(resource, response);
}
- void resetCache(std::function<void (std::exception_ptr)> callback) {
- callback(offlineDatabase->resetCache());
+ void resetDatabase(std::function<void (std::exception_ptr)> callback) {
+ callback(offlineDatabase->resetDatabase());
}
void invalidateTileCache(std::function<void (std::exception_ptr)> callback) {
@@ -339,8 +339,8 @@ void DefaultFileSource::put(const Resource& resource, const Response& response)
impl->actor().invoke(&Impl::put, resource, response);
}
-void DefaultFileSource::resetCache(std::function<void (std::exception_ptr)> callback) {
- impl->actor().invoke(&Impl::resetCache, callback);
+void DefaultFileSource::resetDatabase(std::function<void (std::exception_ptr)> callback) {
+ impl->actor().invoke(&Impl::resetDatabase, std::move(callback));
}
void DefaultFileSource::invalidateTileCache(std::function<void (std::exception_ptr)> callback) {
diff --git a/platform/default/src/mbgl/storage/offline_database.cpp b/platform/default/src/mbgl/storage/offline_database.cpp
index 8c16ebf078..ab04cde5ed 100644
--- a/platform/default/src/mbgl/storage/offline_database.cpp
+++ b/platform/default/src/mbgl/storage/offline_database.cpp
@@ -1195,7 +1195,7 @@ bool OfflineDatabase::exceedsOfflineMapboxTileCountLimit(const Resource& resourc
&& offlineMapboxTileCountLimitExceeded();
}
-std::exception_ptr OfflineDatabase::resetCache() try {
+std::exception_ptr OfflineDatabase::resetDatabase() try {
removeExisting();
initialize();
return nullptr;
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index cba3419672..41c3e93b35 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -222,7 +222,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
view->clearAnnotations();
break;
case GLFW_KEY_I:
- view->resetCacheCallback();
+ view->resetDatabaseCallback();
break;
case GLFW_KEY_K:
view->addRandomCustomPointAnnotations(1);
diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp
index 3322932dde..9c9661546c 100644
--- a/platform/glfw/glfw_view.hpp
+++ b/platform/glfw/glfw_view.hpp
@@ -41,7 +41,7 @@ public:
}
void setResetCacheCallback(std::function<void()> callback) {
- resetCacheCallback = callback;
+ resetDatabaseCallback = callback;
};
void setShouldClose();
@@ -125,7 +125,7 @@ private:
std::function<void()> changeStyleCallback;
std::function<void()> pauseResumeCallback;
std::function<void()> onlineStatusCallback;
- std::function<void()> resetCacheCallback;
+ std::function<void()> resetDatabaseCallback;
std::function<void(mbgl::Map*)> animateRouteCallback;
mbgl::util::RunLoop runLoop;
diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp
index a5001d1204..3c1e50e196 100644
--- a/platform/glfw/main.cpp
+++ b/platform/glfw/main.cpp
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
});
view->setResetCacheCallback([fileSource] () {
- fileSource->resetCache([](std::exception_ptr ex) {
+ fileSource->resetDatabase([](std::exception_ptr ex) {
if (ex) {
mbgl::Log::Error(mbgl::Event::Database, "Failed to reset cache:: %s", mbgl::util::toString(ex).c_str());
}
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 7d90357078..d1aa7e2372 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -1474,7 +1474,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(MergeDatabaseWithDiskFull)) {
}
#endif // __QT__
-TEST(OfflineDatabse, ChangePath) {
+TEST(OfflineDatabase, ChangePath) {
std::string newPath("test/fixtures/offline_database/test.db");
OfflineDatabase db(":memory:");
db.changePath(newPath);
@@ -1482,13 +1482,13 @@ TEST(OfflineDatabse, ChangePath) {
util::deleteFile(newPath);
}
-TEST(OfflineDatabse, resetCache) {
+TEST(OfflineDatabase, ResetDatabase) {
FixtureLog log;
deleteDatabaseFiles();
util::copyFile(filename, "test/fixtures/offline_database/satellite_test.db");
OfflineDatabase db(filename);
- auto result = db.resetCache();
+ auto result = db.resetDatabase();
EXPECT_FALSE(result);
auto regions = db.listRegions().value();