diff options
author | Yuri Gorshenin <y@maps.me> | 2015-07-01 18:49:50 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:53:34 +0300 |
commit | 21286b71c1fc3ac339eb490397c7f84bba80d922 (patch) | |
tree | 3c87c45fc306a395c4bf2858db658220f0a7b285 /indexer/mwm_set.cpp | |
parent | 54e5990c7e4c65b0749c21ce4fe3866909a29668 (diff) |
[indexer, storage, framework] DeleteAllMaps() method is replaced by Clear().
Diffstat (limited to 'indexer/mwm_set.cpp')
-rw-r--r-- | indexer/mwm_set.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/indexer/mwm_set.cpp b/indexer/mwm_set.cpp index d6961ebdd0..2dab311225 100644 --- a/indexer/mwm_set.cpp +++ b/indexer/mwm_set.cpp @@ -70,16 +70,10 @@ MwmSet::MwmSet(size_t cacheSize) MwmSet::~MwmSet() { - // Need do call Cleanup() in derived class. + Clear(); ASSERT(m_cache.empty(), ()); } -void MwmSet::Cleanup() -{ - lock_guard<mutex> lock(m_lock); - ClearCacheImpl(m_cache.begin(), m_cache.end()); -} - MwmSet::MwmId MwmSet::GetMwmIdByCountryFileImpl(CountryFile const & countryFile) const { string const name = countryFile.GetNameWithoutExt(); @@ -172,23 +166,6 @@ bool MwmSet::DeregisterImpl(CountryFile const & countryFile) return deregistered; } -void MwmSet::DeregisterAll() -{ - lock_guard<mutex> lock(m_lock); - - for (auto const & p : m_info) - { - // Vector of shared pointers is copied here because an original - // vector will be modified by the body of the cycle. - vector<shared_ptr<MwmInfo>> infos = p.second; - for (shared_ptr<MwmInfo> info : infos) - DeregisterImpl(MwmId(info)); - } - - // Do not call ClearCache - it's under mutex lock. - ClearCacheImpl(m_cache.begin(), m_cache.end()); -} - bool MwmSet::IsLoaded(CountryFile const & countryFile) const { lock_guard<mutex> lock(m_lock); @@ -267,6 +244,13 @@ void MwmSet::UnlockValueImpl(MwmId const & id, TMwmValueBasePtr p) } } +void MwmSet::Clear() +{ + lock_guard<mutex> lock(m_lock); + ClearCacheImpl(m_cache.begin(), m_cache.end()); + m_info.clear(); +} + void MwmSet::ClearCache() { lock_guard<mutex> lock(m_lock); |