summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-01-14 15:02:14 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-01-15 10:38:09 +0100
commit8939a7b7069124adac44ef822bfe6d97adcc14d6 (patch)
tree2ba38638a022a49a62eeb1429248a3e14bced48b
parentf62d41ae05adade69fb08cff3c071b960c25c857 (diff)
downloadqtlocation-mapboxgl-8939a7b7069124adac44ef822bfe6d97adcc14d6.tar.gz
[core] move SharedSQLiteCache::get to SQLiteCache::getShared
-rw-r--r--platform/default/default_file_source.cpp2
-rw-r--r--platform/default/sqlite_cache.cpp4
-rw-r--r--src/mbgl/storage/sqlite_cache.hpp11
3 files changed, 5 insertions, 12 deletions
diff --git a/platform/default/default_file_source.cpp b/platform/default/default_file_source.cpp
index fcb45ee29a..a1f8bc2c48 100644
--- a/platform/default/default_file_source.cpp
+++ b/platform/default/default_file_source.cpp
@@ -22,7 +22,7 @@ class DefaultFileSource::Impl {
public:
Impl(const std::string& cachePath, const std::string& assetRoot)
: assetFileSource(assetRoot),
- cache(SharedSQLiteCache::get(cachePath)),
+ cache(SQLiteCache::getShared(cachePath)),
onlineFileSource(cache.get()) {
}
diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp
index 444637b9af..88bedec699 100644
--- a/platform/default/sqlite_cache.cpp
+++ b/platform/default/sqlite_cache.cpp
@@ -472,7 +472,7 @@ void SQLiteCache::Impl::refresh(const Resource& resource, Seconds expires) {
}
}
-std::shared_ptr<SQLiteCache> SharedSQLiteCache::get(const std::string &path) {
+std::shared_ptr<SQLiteCache> SQLiteCache::getShared(const std::string &path) {
std::shared_ptr<SQLiteCache> temp = masterPtr.lock();
if (!temp) {
temp.reset(new SQLiteCache(path));
@@ -482,6 +482,6 @@ std::shared_ptr<SQLiteCache> SharedSQLiteCache::get(const std::string &path) {
return temp;
}
-std::weak_ptr<SQLiteCache> SharedSQLiteCache::masterPtr;
+std::weak_ptr<SQLiteCache> SQLiteCache::masterPtr;
} // namespace mbgl
diff --git a/src/mbgl/storage/sqlite_cache.hpp b/src/mbgl/storage/sqlite_cache.hpp
index 94eeee3d46..fd02765e78 100644
--- a/src/mbgl/storage/sqlite_cache.hpp
+++ b/src/mbgl/storage/sqlite_cache.hpp
@@ -20,6 +20,8 @@ template <typename T> class Thread;
class SQLiteCache : private util::noncopyable {
public:
+ static std::shared_ptr<SQLiteCache> getShared(const std::string &path = ":memory:");
+
SQLiteCache(const std::string &path = ":memory:");
~SQLiteCache();
@@ -35,15 +37,6 @@ public:
private:
const std::unique_ptr<util::Thread<Impl>> thread;
-};
-
-class SharedSQLiteCache : util::noncopyable {
-public:
- static std::shared_ptr<SQLiteCache> get(const std::string &path = ":memory:");
-
-private:
- SharedSQLiteCache() {}
-
static std::weak_ptr<SQLiteCache> masterPtr;
};