summaryrefslogtreecommitdiff
path: root/include/mbgl/storage
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2017-02-27 12:02:06 -0800
committerJesse Bounds <jesse@rebounds.net>2017-03-01 08:25:44 -0800
commite1546644b55dab8ea0171f415fe491ae21d5d89b (patch)
tree3b28c1860667ef75bb4dbf33a93e63daa094d146 /include/mbgl/storage
parentc689eed2737cf07f38c2e6f63560a92a58875f19 (diff)
downloadqtlocation-mapboxgl-e1546644b55dab8ea0171f415fe491ae21d5d89b.tar.gz
[core] Cache file source base URL and access token
This caches the base URL and access token values when they are set so that they can still be retrieved even when the thread is paused.
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r--include/mbgl/storage/default_file_source.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index effc60745e..9262e0a1bc 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -115,7 +115,23 @@ public:
*/
void setOfflineMapboxTileCountLimit(uint64_t) const;
+ /*
+ * Pause file request activity.
+ *
+ * If pause is called then no revalidation or network request activity
+ * will occur.
+ *
+ * Note: Calling pause and then calling getAPIBaseURL or getAccessToken
+ * will lock the thread that those calls are made on.
+ */
void pause();
+
+ /*
+ * Resume file request activity.
+ *
+ * Calling resume will unpause the file source and process any tasks that
+ * expired while the file source was paused.
+ */
void resume();
// For testing only.
@@ -127,6 +143,8 @@ private:
const std::unique_ptr<util::Thread<Impl>> thread;
const std::unique_ptr<FileSource> assetFileSource;
const std::unique_ptr<FileSource> localFileSource;
+ std::string cachedBaseURL = mbgl::util::API_BASE_URL;
+ std::string cachedAccessToken;
};
} // namespace mbgl