Skip to content

Commit

Permalink
Fix some problems that only showed up in Unreal.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Oct 28, 2024
1 parent 727a68d commit c75831f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions CesiumAsync/include/CesiumAsync/SharedAssetDepot.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,21 @@ class CESIUMASYNC_API SharedAssetDepot
*/
size_t getUsageCount() const {
size_t count = 0;
for (const auto& [key, item] : _assets) {
count += item->_referenceCount;
for (const auto& [key, pEntry] : _assets) {
if (pEntry->pAsset) {
count += pEntry->pAsset->_referenceCount;
}
}
return count;
}

size_t getDeletionCandidateCount() const {
std::lock_guard lock(this->_deletionCandidatesMutex);
std::lock_guard lock(this->_mutex);
return this->_deletionCandidates.size();
}

int64_t getDeletionCandidateTotalSizeBytes() const {
std::lock_guard lock(this->_mutex);
return this->_totalDeletionCandidateMemoryUsage;
}

Expand Down Expand Up @@ -411,11 +414,11 @@ class CESIUMASYNC_API SharedAssetDepot

// The total amount of memory used by all assets in the _deletionCandidates
// list.
std::atomic<int64_t> _totalDeletionCandidateMemoryUsage;
int64_t _totalDeletionCandidateMemoryUsage;

// Mutex serializing access to _assets, _assetsByPointer, _deletionCandidates,
// and any AssetEntry owned by this depot.
std::mutex _mutex;
mutable std::mutex _mutex;

// The factory used to create new AssetType instances.
std::function<FactorySignature> _factory;
Expand Down

0 comments on commit c75831f

Please sign in to comment.