| 616 | } |
| 617 | |
| 618 | void Assets::cleanup() { |
| 619 | MutexLocker assetsLocker(m_assetsMutex); |
| 620 | |
| 621 | double time = Time::monotonicTime(); |
| 622 | |
| 623 | auto it = makeSMutableMapIterator(m_assetsCache); |
| 624 | while (it.hasNext()) { |
| 625 | auto pair = it.next(); |
| 626 | // Don't clean up broken assets or queued assets. |
| 627 | if (pair.second && !m_queue.contains(pair.first)) { |
| 628 | double liveTime = time - pair.second->time; |
| 629 | if (liveTime > m_settings.assetTimeToLive) { |
| 630 | // If the asset should persist, just refresh the access time. |
| 631 | if (pair.second->shouldPersist()) |
| 632 | pair.second->time = time; |
| 633 | else |
| 634 | it.remove(); |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | bool Assets::AssetId::operator==(AssetId const& assetId) const { |
| 641 | return tie(type, path) == tie(assetId.type, assetId.path); |
nothing calls this directly
no test coverage detected