| 158 | } // namespace |
| 159 | |
| 160 | void Storage::ApplyCountriesInMemory(std::string const & buffer) |
| 161 | { |
| 162 | LOG(LDEBUG, ("COUNTRIES: applying in-memory")); |
| 163 | /// @todo(pastk): why do we need a temp dummy Storage object? |
| 164 | std::shared_ptr<Storage> parsed(new Storage(7 /* dummy */)); |
| 165 | int64_t const newVersion = |
| 166 | LoadCountriesFromBuffer(buffer, parsed->m_countries, parsed->m_affiliations, parsed->m_countryNameSynonyms, |
| 167 | parsed->m_mwmTopCityGeoIds, parsed->m_mwmTopCountryGeoIds, parsed->m_mapSeries); |
| 168 | |
| 169 | ASSERT_GREATER(newVersion, m_currentVersion, ()); |
| 170 | |
| 171 | m_currentVersion = newVersion; |
| 172 | m_countries = std::move(parsed->m_countries); |
| 173 | |
| 174 | m_downloader->SetDataVersion(m_currentVersion); |
| 175 | m_downloader->ResetMetaConfig(); |
| 176 | |
| 177 | RegisterAllLocalMaps(false /* enableDiffs */); |
| 178 | |
| 179 | m_affiliations = std::move(parsed->m_affiliations); |
| 180 | m_countryNameSynonyms = std::move(parsed->m_countryNameSynonyms); |
| 181 | m_mwmTopCityGeoIds = std::move(parsed->m_mwmTopCityGeoIds); |
| 182 | m_mwmTopCountryGeoIds = std::move(parsed->m_mwmTopCountryGeoIds); |
| 183 | |
| 184 | NotifyStatusChanged(GetRootId()); |
| 185 | |
| 186 | for (auto const & p : m_localFiles) |
| 187 | if (IsNode(p.first)) |
| 188 | NotifyStatusChangedForHierarchy(p.first); |
| 189 | |
| 190 | LOG(LDEBUG, ("COUNTRIES: applied in-memory, new version", m_currentVersion)); |
| 191 | NotifyCheckUpdatesResult(storage::CheckUpdatesStatus::Updated); |
| 192 | } |
| 193 | |
| 194 | void Storage::ApplyPendingCountriesIfAny() |
| 195 | { |
nothing calls this directly
no test coverage detected