diff --git a/CesiumAsync/include/CesiumAsync/SharedAssetDepot.h b/CesiumAsync/include/CesiumAsync/SharedAssetDepot.h index e5e7e87b0..c74dbf727 100644 --- a/CesiumAsync/include/CesiumAsync/SharedAssetDepot.h +++ b/CesiumAsync/include/CesiumAsync/SharedAssetDepot.h @@ -207,19 +207,7 @@ class CESIUMASYNC_API SharedAssetDepot */ CesiumUtility::DoublyLinkedListPointers deletionListPointers; - CesiumUtility::ResultPointer toResultUnderLock() const { - // This method is called while the calling thread already owns the depot - // mutex. So we must take care not to lock it again, which could happen if - // the asset is currently unreferenced and we naively create an - // IntrusivePointer for it. - CesiumUtility::IntrusivePointer p = nullptr; - if (pAsset) { - pAsset->addReference(true); - p = pAsset.get(); - pAsset->releaseReference(true); - } - return CesiumUtility::ResultPointer(p, errorsAndWarnings); - } + CesiumUtility::ResultPointer toResultUnderLock() const; }; // Maps asset keys to AssetEntry instances. This collection owns the asset @@ -510,4 +498,20 @@ void SharedAssetDepot::unmarkDeletionCandidateUnderLock( this->_pKeepAlive = this; } +template +CesiumUtility::ResultPointer +SharedAssetDepot::AssetEntry::toResultUnderLock() const { + // This method is called while the calling thread already owns the depot + // mutex. So we must take care not to lock it again, which could happen if + // the asset is currently unreferenced and we naively create an + // IntrusivePointer for it. + CesiumUtility::IntrusivePointer p = nullptr; + if (pAsset) { + pAsset->addReference(true); + p = pAsset.get(); + pAsset->releaseReference(true); + } + return CesiumUtility::ResultPointer(p, errorsAndWarnings); +} + } // namespace CesiumAsync