VideoCommon: remove 'GetLastAssetWriteTime' and switch to a steady_clock for asset times

This commit is contained in:
iwubcode
2025-05-04 17:50:14 -05:00
parent 15f125ebee
commit bafe78203d
5 changed files with 13 additions and 67 deletions

View File

@ -17,6 +17,9 @@ namespace VideoCommon
class CustomAsset
{
public:
using ClockType = std::chrono::steady_clock;
using TimeType = ClockType::time_point;
CustomAsset(std::shared_ptr<CustomAssetLibrary> library,
const CustomAssetLibrary::AssetID& asset_id, u64 session_id);
virtual ~CustomAsset() = default;
@ -32,13 +35,8 @@ public:
// returns the number of bytes unloaded
std::size_t Unload();
// Queries the last time the asset was modified or standard epoch time
// if the asset hasn't been modified yet
// Note: not thread safe, expected to be called by the loader
CustomAssetLibrary::TimeType GetLastWriteTime() const;
// Returns the time that the data was last loaded
const CustomAssetLibrary::TimeType& GetLastLoadedTime() const;
const TimeType& GetLastLoadedTime() const;
// Returns an id that uniquely identifies this asset
const CustomAssetLibrary::AssetID& GetAssetId() const;
@ -63,7 +61,7 @@ private:
mutable std::mutex m_info_lock;
std::size_t m_bytes_loaded = 0;
CustomAssetLibrary::TimeType m_last_loaded_time = {};
TimeType m_last_loaded_time = {};
};
// An abstract class that is expected to
@ -115,7 +113,7 @@ template <typename AssetType>
struct CachedAsset
{
std::shared_ptr<AssetType> m_asset;
VideoCommon::CustomAssetLibrary::TimeType m_cached_write_time;
CustomAsset::TimeType m_cached_write_time;
};
} // namespace VideoCommon