From e1546644b55dab8ea0171f415fe491ae21d5d89b Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Mon, 27 Feb 2017 12:02:06 -0800 Subject: [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. --- include/mbgl/storage/default_file_source.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/mbgl/storage') 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> thread; const std::unique_ptr assetFileSource; const std::unique_ptr localFileSource; + std::string cachedBaseURL = mbgl::util::API_BASE_URL; + std::string cachedAccessToken; }; } // namespace mbgl -- cgit v1.2.1