summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2015-09-16 12:45:46 +1000
committerLeith Bade <leith@mapbox.com>2015-09-16 12:45:46 +1000
commit529a7cc93c7819c62d81bd825e8682cf3f93b495 (patch)
tree0e9fab0ff96f75e6f709baa8e38ae6fe6cc844e0 /platform
parent765f884ac96c149af3c8e7c11f011bfe9c51b6eb (diff)
downloadqtlocation-mapboxgl-529a7cc93c7819c62d81bd825e8682cf3f93b495.tar.gz
Create SharedSQLiteCache
Diffstat (limited to 'platform')
-rw-r--r--platform/default/sqlite_cache.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp
index 9d5d0541e8..8863c151e7 100644
--- a/platform/default/sqlite_cache.cpp
+++ b/platform/default/sqlite_cache.cpp
@@ -264,4 +264,16 @@ void SQLiteCache::Impl::refresh(const Resource& resource, int64_t expires) {
}
}
+std::shared_ptr<SQLiteCache> SharedSQLiteCache::get(const std::string &path) {
+ std::shared_ptr<SQLiteCache> temp = masterPtr.lock();
+ if (!temp) {
+ temp.reset(new SQLiteCache(path));
+ masterPtr = temp;
+ }
+
+ return temp;
+}
+
+std::weak_ptr<SQLiteCache> SharedSQLiteCache::masterPtr;
+
}