forked from organicmaps/organicmaps-tmp
Disable keep downloading queue for prefetch storage
This commit is contained in:
parent
06e7b8cd9b
commit
bcbddb2c26
2 changed files with 12 additions and 0 deletions
|
@ -184,6 +184,7 @@ void Storage::PrefetchMigrateData()
|
|||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
||||
m_prefetchStorage.reset(new Storage(COUNTRIES_FILE, "migrate"));
|
||||
m_prefetchStorage->EnableKeepDownloadingQueue(false);
|
||||
m_prefetchStorage->Init([](LocalCountryFile const &){});
|
||||
if (!m_downloadingUrlsForTesting.empty())
|
||||
m_prefetchStorage->SetDownloadingUrlsForTesting(m_downloadingUrlsForTesting);
|
||||
|
@ -432,6 +433,9 @@ void Storage::SaveDownloadQueue()
|
|||
{
|
||||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
||||
if (!m_keepDownloadingQueue)
|
||||
return;
|
||||
|
||||
stringstream ss;
|
||||
for (auto const & item : m_queue)
|
||||
ss << (ss.str().empty() ? "" : ";") << item.GetCountryId();
|
||||
|
@ -440,6 +444,9 @@ void Storage::SaveDownloadQueue()
|
|||
|
||||
void Storage::RestoreDownloadQueue()
|
||||
{
|
||||
if (!m_keepDownloadingQueue)
|
||||
return;
|
||||
|
||||
string queue;
|
||||
if (!Settings::Get("DownloadQueue", queue))
|
||||
return;
|
||||
|
|
|
@ -106,6 +106,10 @@ private:
|
|||
/// can call all the methods from a single thread using
|
||||
/// RunOnUIThread. If not, at least use a syncronization object.
|
||||
TQueue m_queue;
|
||||
|
||||
// Keep downloading queue between application restarts.
|
||||
bool m_keepDownloadingQueue = true;
|
||||
|
||||
/// Set of mwm files which have been downloaded recently.
|
||||
/// When a mwm file is downloaded it's moved from |m_queue| to |m_justDownloaded|.
|
||||
/// When a new mwm file is added to |m_queue| |m_justDownloaded| is cleared.
|
||||
|
@ -402,6 +406,7 @@ public:
|
|||
bool IsDownloadInProgress() const;
|
||||
|
||||
TCountryId GetCurrentDownloadingCountryId() const;
|
||||
void EnableKeepDownloadingQueue(bool enable) {m_keepDownloadingQueue = enable;}
|
||||
|
||||
/// get download url by countryId & options(first search file name by countryId, then format url)
|
||||
string GetFileDownloadUrl(string const & baseUrl, TCountryId const & countryId, MapOptions file) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue