diff --git a/Source/Core/DolphinQt2/GameList/GameFileCache.cpp b/Source/Core/DolphinQt2/GameList/GameFileCache.cpp index a80194d4fc..167218c438 100644 --- a/Source/Core/DolphinQt2/GameList/GameFileCache.cpp +++ b/Source/Core/DolphinQt2/GameList/GameFileCache.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include "Common/FileUtil.h" @@ -20,24 +21,18 @@ GameFileCache::GameFileCache() { } -bool GameFileCache::IsCached(const QString& path) +bool GameFileCache::IsCached(const QString& path) const { - std::lock_guard guard(m_mutex); - return m_gamefiles.contains(path); } -GameFile GameFileCache::GetFile(const QString& path) +GameFile GameFileCache::GetFile(const QString& path) const { - std::lock_guard guard(m_mutex); - return m_gamefiles[path]; } void GameFileCache::Load() { - std::lock_guard guard(m_mutex); - QFile file(m_path); if (!file.open(QIODevice::ReadOnly)) @@ -56,10 +51,8 @@ void GameFileCache::Load() stream >> m_gamefiles; } -void GameFileCache::Save() +void GameFileCache::Save() const { - std::lock_guard guard(m_mutex); - QFile file(m_path); if (!file.open(QIODevice::WriteOnly)) @@ -74,14 +67,10 @@ void GameFileCache::Save() void GameFileCache::Update(const GameFile& gamefile) { - std::lock_guard guard(m_mutex); - m_gamefiles[gamefile.GetFilePath()] = gamefile; } -QList GameFileCache::GetCached() +QList GameFileCache::GetCached() const { - std::lock_guard guard(m_mutex); - return m_gamefiles.keys(); } diff --git a/Source/Core/DolphinQt2/GameList/GameFileCache.h b/Source/Core/DolphinQt2/GameList/GameFileCache.h index b1a505c0f2..df4cd75f16 100644 --- a/Source/Core/DolphinQt2/GameList/GameFileCache.h +++ b/Source/Core/DolphinQt2/GameList/GameFileCache.h @@ -4,9 +4,9 @@ #pragma once -#include - -#include +#include +#include +#include #include "DolphinQt2/GameList/GameFile.h" @@ -16,15 +16,14 @@ public: explicit GameFileCache(); void Update(const GameFile& gamefile); - void Save(); + void Save() const; void Load(); - bool IsCached(const QString& path); - GameFile GetFile(const QString& path); - QList GetCached(); + bool IsCached(const QString& path) const; + GameFile GetFile(const QString& path) const; + QList GetCached() const; private: QString m_path; QMap m_gamefiles; - std::mutex m_mutex; };