summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-05-26 18:40:49 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-05-27 10:05:36 +0300
commit5cf0fc0f8bb3f66fd7844cae73efca1a4c2d94f5 (patch)
tree7eeaf0d37926bcbda1dc4dea07d79dfbfa9c41d0 /include
parent89129379f18b913a7c2b7a7ff99644e277e9d3ff (diff)
downloadqtlocation-mapboxgl-5cf0fc0f8bb3f66fd7844cae73efca1a4c2d94f5.tar.gz
[core] default file source - ensure thread safety for cached values
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/storage/default_file_source.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index 1e60d2bc5a..f929334f28 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -5,6 +5,7 @@
#include <mbgl/util/constants.hpp>
#include <vector>
+#include <mutex>
namespace mbgl {
@@ -34,10 +35,10 @@ public:
}
void setAPIBaseURL(const std::string&);
- std::string getAPIBaseURL() const;
+ std::string getAPIBaseURL();
void setAccessToken(const std::string&);
- std::string getAccessToken() const;
+ std::string getAccessToken();
void setResourceTransform(std::function<std::string(Resource::Kind, std::string&&)>);
@@ -143,7 +144,11 @@ private:
// Shared so destruction is done on this thread
const std::shared_ptr<FileSource> assetFileSource;
const std::unique_ptr<util::Thread<Impl>> thread;
+
+ std::mutex cachedBaseURLMutex;
std::string cachedBaseURL = mbgl::util::API_BASE_URL;
+
+ std::mutex cachedAccessTokenMutex;
std::string cachedAccessToken;
};