forked from organicmaps/organicmaps
Synchronization of CountryInfoGetter object in search::Engine.
This commit is contained in:
parent
a97b09700a
commit
cc498ad4c1
3 changed files with 23 additions and 6 deletions
|
@ -668,6 +668,9 @@ void Framework::MemoryWarning()
|
|||
{
|
||||
// clearing caches on memory warning.
|
||||
m_model.ClearCaches();
|
||||
|
||||
GetSearchEngine()->ClearCaches();
|
||||
|
||||
LOG(LINFO, ("MemoryWarning"));
|
||||
}
|
||||
|
||||
|
|
|
@ -265,23 +265,35 @@ void Engine::SearchAsync()
|
|||
}
|
||||
}
|
||||
|
||||
string Engine::GetCountryFile(m2::PointD const & pt) const
|
||||
string Engine::GetCountryFile(m2::PointD const & pt)
|
||||
{
|
||||
threads::MutexGuard searchGuard(m_searchMutex);
|
||||
|
||||
return m_pData->m_infoGetter.GetRegionFile(pt);
|
||||
}
|
||||
|
||||
string Engine::GetCountryCode(m2::PointD const & pt) const
|
||||
string Engine::GetCountryCode(m2::PointD const & pt)
|
||||
{
|
||||
threads::MutexGuard searchGuard(m_searchMutex);
|
||||
|
||||
storage::CountryInfo info;
|
||||
m_pData->m_infoGetter.GetRegionInfo(pt, info);
|
||||
return info.m_flag;
|
||||
}
|
||||
|
||||
string Engine::GetCountryName(m2::PointD const & pt) const
|
||||
string Engine::GetCountryName(m2::PointD const & pt)
|
||||
{
|
||||
threads::MutexGuard searchGuard(m_searchMutex);
|
||||
|
||||
storage::CountryInfo info;
|
||||
m_pData->m_infoGetter.GetRegionInfo(pt, info);
|
||||
return info.m_name;
|
||||
}
|
||||
|
||||
void Engine::ClearCaches()
|
||||
{
|
||||
/// @todo Add m_pData->m_infoGetter clearing routine.
|
||||
/// Now we have prereserved cache size.
|
||||
}
|
||||
|
||||
} // namespace search
|
||||
|
|
|
@ -40,9 +40,11 @@ public:
|
|||
bool hasPt, double lat, double lon);
|
||||
void Search(SearchParams const & params, m2::RectD const & viewport);
|
||||
|
||||
string GetCountryFile(m2::PointD const & pt) const;
|
||||
string GetCountryCode(m2::PointD const & pt) const;
|
||||
string GetCountryName(m2::PointD const & pt) const;
|
||||
string GetCountryFile(m2::PointD const & pt);
|
||||
string GetCountryCode(m2::PointD const & pt);
|
||||
string GetCountryName(m2::PointD const & pt);
|
||||
|
||||
void ClearCaches();
|
||||
|
||||
private:
|
||||
static const int RESULTS_COUNT = 15;
|
||||
|
|
Loading…
Add table
Reference in a new issue