summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/GameList/GameFileCache.cpp
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2018-01-04 22:44:53 +0100
committerGitHub <noreply@github.com>2018-01-04 22:44:53 +0100
commite31f8f8ecb901a81cdf6075ca305032a6ba3366b (patch)
tree1b2b861b297c930bd02b46257ac0cbd876503606 /Source/Core/DolphinQt2/GameList/GameFileCache.cpp
parent637fbec35dc59ee4b2c6b8a0283d8af77670aac2 (diff)
parente44b64b82c240342e72b6c8e425b03d97554008d (diff)
Merge pull request #6284 from JosJuice/qt-gamefilecache-mutex
DolphinQt2: Don't use a mutex in GameFileCache
Diffstat (limited to 'Source/Core/DolphinQt2/GameList/GameFileCache.cpp')
-rw-r--r--Source/Core/DolphinQt2/GameList/GameFileCache.cpp21
1 files changed, 5 insertions, 16 deletions
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 <QDataStream>
#include <QDir>
+#include <QFile>
#include <QFileInfo>
#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<std::mutex> guard(m_mutex);
-
return m_gamefiles.contains(path);
}
-GameFile GameFileCache::GetFile(const QString& path)
+GameFile GameFileCache::GetFile(const QString& path) const
{
- std::lock_guard<std::mutex> guard(m_mutex);
-
return m_gamefiles[path];
}
void GameFileCache::Load()
{
- std::lock_guard<std::mutex> 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<std::mutex> 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<std::mutex> guard(m_mutex);
-
m_gamefiles[gamefile.GetFilePath()] = gamefile;
}
-QList<QString> GameFileCache::GetCached()
+QList<QString> GameFileCache::GetCached() const
{
- std::lock_guard<std::mutex> guard(m_mutex);
-
return m_gamefiles.keys();
}