| 82 | } |
| 83 | |
| 84 | void ReadManager::OnTaskFinished(threads::IRoutine * task) |
| 85 | { |
| 86 | ASSERT(dynamic_cast<ReadMWMTask *>(task) != NULL, ()); |
| 87 | auto t = static_cast<ReadMWMTask *>(task); |
| 88 | |
| 89 | // finish tiles |
| 90 | { |
| 91 | std::lock_guard lock(m_finishedTilesMutex); |
| 92 | |
| 93 | // decrement counter |
| 94 | ASSERT_GREATER(m_counter, 0, ()); |
| 95 | if (--m_counter == 0) |
| 96 | { |
| 97 | m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, make_unique_dp<FinishReadingMessage>(), |
| 98 | MessagePriority::Normal); |
| 99 | } |
| 100 | |
| 101 | auto const & key = t->GetTileKey(); |
| 102 | if (!task->IsCancelled()) |
| 103 | { |
| 104 | auto const it = m_activeTiles.find(key); |
| 105 | ASSERT(it != m_activeTiles.end(), ()); |
| 106 | |
| 107 | // Use the tile key from active tiles with the actual user marks generation. |
| 108 | TTilesCollection tiles; |
| 109 | tiles.emplace(*it); |
| 110 | |
| 111 | m_activeTiles.erase(it); |
| 112 | |
| 113 | m_commutator->PostMessage( |
| 114 | ThreadsCommutator::ResourceUploadThread, |
| 115 | make_unique_dp<FinishTileReadMessage>(std::move(tiles), true /* forceUpdateUserMarks */), |
| 116 | MessagePriority::Normal); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | t->Reset(); |
| 121 | m_tasksPool.Return(t); |
| 122 | } |
| 123 | |
| 124 | void ReadManager::UpdateCoverage(ScreenBase const & screen, bool have3dBuildings, bool forceUpdate, |
| 125 | bool forceUpdateUserMarks, TTilesCollection const & tiles, |
nothing calls this directly
no test coverage detected