summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/GameFileCache.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-12-11 21:46:59 +0100
committerGitHub <noreply@github.com>2023-12-11 21:46:59 +0100
commitdd0ac7d53c24996f413ae57babcb3ec2b1c0279e (patch)
tree848a299b9f2f8e8c43186a81d01dc139508b5c3b /Source/Core/UICommon/GameFileCache.cpp
parentf87a4f03855208397972cbb1f545cd0cd5122428 (diff)
parentff38362216ff3e73eb99f7fda90ec802da1386ff (diff)
Merge pull request #12387 from lioncash/cache
GameFileCache: Pass std::function by reference rather than by value
Diffstat (limited to 'Source/Core/UICommon/GameFileCache.cpp')
-rw-r--r--Source/Core/UICommon/GameFileCache.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp
index d9b08f63d5..2838d331d8 100644
--- a/Source/Core/UICommon/GameFileCache.cpp
+++ b/Source/Core/UICommon/GameFileCache.cpp
@@ -43,7 +43,7 @@ GameFileCache::GameFileCache() : m_path(File::GetUserPath(D_CACHE_IDX) + "gameli
{
}
-void GameFileCache::ForEach(std::function<void(const std::shared_ptr<const GameFile>&)> f) const
+void GameFileCache::ForEach(const ForEachFn& f) const
{
for (const std::shared_ptr<GameFile>& item : m_cached_files)
f(item);
@@ -83,11 +83,10 @@ std::shared_ptr<const GameFile> GameFileCache::AddOrGet(const std::string& path,
return result;
}
-bool GameFileCache::Update(
- const std::vector<std::string>& all_game_paths,
- std::function<void(const std::shared_ptr<const GameFile>&)> game_added_to_cache,
- std::function<void(const std::string&)> game_removed_from_cache,
- const std::atomic_bool& processing_halted)
+bool GameFileCache::Update(std::span<const std::string> all_game_paths,
+ const GameAddedToCacheFn& game_added_to_cache,
+ const GameRemovedFromCacheFn& game_removed_from_cache,
+ const std::atomic_bool& processing_halted)
{
// Copy game paths into a set, except ones that match DiscIO::ShouldHideFromGameList.
// TODO: Prevent DoFileSearch from looking inside /files/ directories of DirectoryBlobs at all?
@@ -151,9 +150,8 @@ bool GameFileCache::Update(
return cache_changed;
}
-bool GameFileCache::UpdateAdditionalMetadata(
- std::function<void(const std::shared_ptr<const GameFile>&)> game_updated,
- const std::atomic_bool& processing_halted)
+bool GameFileCache::UpdateAdditionalMetadata(const GameUpdatedFn& game_updated,
+ const std::atomic_bool& processing_halted)
{
bool cache_changed = false;