UI: Cancel loaders on shutdown.

Improves backend switching / locking / etc. performance when the recent
list has games that aren't currently available.

Also, remove unnecessary duplicate gameinfo flush on EGL loop shutdown.
Already happens in NativeShutdownGraphics().
This commit is contained in:
Unknown W. Brackets 2017-12-09 16:48:38 -08:00
parent ee5b68f1fc
commit 2943bbdbfd
3 changed files with 14 additions and 2 deletions

View File

@ -674,6 +674,8 @@ void GameInfoCache::Init() {
}
void GameInfoCache::Shutdown() {
CancelAll();
if (gameInfoWQ_) {
StopProcessingWorkQueue(gameInfoWQ_);
delete gameInfoWQ_;
@ -682,6 +684,8 @@ void GameInfoCache::Shutdown() {
}
void GameInfoCache::Clear() {
CancelAll();
if (gameInfoWQ_) {
gameInfoWQ_->Flush();
gameInfoWQ_->WaitUntilDone();
@ -689,6 +693,15 @@ void GameInfoCache::Clear() {
info_.clear();
}
void GameInfoCache::CancelAll() {
for (auto info : info_) {
FileLoader *fl = info.second->GetFileLoader();
if (fl) {
fl->Cancel();
}
}
}
void GameInfoCache::FlushBGs() {
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
std::lock_guard<std::mutex> lock(iter->second->lock);

View File

@ -173,6 +173,7 @@ public:
PrioritizedWorkQueue *WorkQueue() { return gameInfoWQ_; }
void CancelAll();
void WaitUntilDone(std::shared_ptr<GameInfo> &info);
private:

View File

@ -1171,8 +1171,6 @@ retry:
}
ILOG("Leaving EGL/Vulkan render loop.");
if (g_gameInfoCache)
g_gameInfoCache->WorkQueue()->Flush();
NativeShutdownGraphics();
renderer_inited = false;