forked from organicmaps/organicmaps
Do correct and full cache clearing (for Index and search::Engine).
This commit is contained in:
parent
b02b5b055f
commit
20e3ed1758
4 changed files with 20 additions and 10 deletions
|
@ -866,12 +866,15 @@ void Framework::DisablePlacemark()
|
|||
m_drawPlacemark = false;
|
||||
}
|
||||
|
||||
void Framework::ClearAllCaches()
|
||||
{
|
||||
m_model.ClearCaches();
|
||||
GetSearchEngine()->ClearAllCaches();
|
||||
}
|
||||
|
||||
void Framework::MemoryWarning()
|
||||
{
|
||||
// clearing caches on memory warning.
|
||||
m_model.ClearCaches();
|
||||
|
||||
GetSearchEngine()->ClearCaches();
|
||||
ClearAllCaches();
|
||||
|
||||
LOG(LINFO, ("MemoryWarning"));
|
||||
}
|
||||
|
@ -882,8 +885,11 @@ void Framework::MemoryWarning()
|
|||
|
||||
void Framework::EnterBackground()
|
||||
{
|
||||
// clearing caches on entering background.
|
||||
m_model.ClearCaches();
|
||||
// Do not clear caches for Android. This function is called when main activity is paused,
|
||||
// but at the same time search activity (for example) is enabled.
|
||||
#ifndef OMIM_OS_ANDROID
|
||||
ClearAllCaches();
|
||||
#endif
|
||||
|
||||
double val = 0;
|
||||
(void)Settings::Get(FOREGROUND_TIME_SETTINGS, val);
|
||||
|
|
|
@ -143,6 +143,8 @@ protected:
|
|||
|
||||
BenchmarkEngine * m_benchmarkEngine;
|
||||
|
||||
void ClearAllCaches();
|
||||
|
||||
public:
|
||||
Framework();
|
||||
virtual ~Framework();
|
||||
|
|
|
@ -346,10 +346,12 @@ void Engine::ClearViewportsCache()
|
|||
m_pQuery->ClearCaches();
|
||||
}
|
||||
|
||||
void Engine::ClearCaches()
|
||||
void Engine::ClearAllCaches()
|
||||
{
|
||||
/// @todo Add m_pData->m_infoGetter clearing routine.
|
||||
/// Now we have prereserved cache size.
|
||||
threads::MutexGuard guard(m_searchMutex);
|
||||
|
||||
m_pQuery->ClearCaches();
|
||||
m_pData->m_infoGetter.ClearCaches();
|
||||
}
|
||||
|
||||
} // namespace search
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
m2::RectD GetCountryBounds(string const & file) const;
|
||||
|
||||
void ClearViewportsCache();
|
||||
void ClearCaches();
|
||||
void ClearAllCaches();
|
||||
|
||||
private:
|
||||
static const int RESULTS_COUNT = 15;
|
||||
|
|
Loading…
Add table
Reference in a new issue