diff options
| author | JosJuice <josjuice@gmail.com> | 2021-08-24 15:07:15 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-08-24 15:35:39 +0200 |
| commit | fb265b610de08df5509e56beeb3dbff68f7d4396 (patch) | |
| tree | fd316440852ab3df13acb4f6e38c87d978490e78 /Source/Android/app/src/main/java | |
| parent | bba33c7cede68259c7f2b05e9964960d9e2570e4 (diff) | |
Android: Don't hold gameFileCache lock during updateAdditionalMetadata
It seems like we spend a lot of the game list scanning time in
updateAdditionalMetadata, which I suppose makes sense considering
how many different files that function attempts to open.
With the addition of just one little atomic operation, we can make
it safe to call updateAdditionalMetadata without holding a lock.
Diffstat (limited to 'Source/Android/app/src/main/java')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java index 1a9284a9c4..a8ecc367c9 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheService.java @@ -194,26 +194,27 @@ public final class GameFileCacheService extends IntentService { String[] gamePaths = GameFileCache.getAllGamePaths(); + boolean changed; synchronized (gameFileCache) { - boolean changed = gameFileCache.update(gamePaths); - if (changed) - { - updateGameFileArray(); - sendBroadcast(CACHE_UPDATED); - } - - boolean additionalMetadataChanged = gameFileCache.updateAdditionalMetadata(); - if (additionalMetadataChanged) - { - updateGameFileArray(); - sendBroadcast(CACHE_UPDATED); - } - - if (changed || additionalMetadataChanged) - { - gameFileCache.save(); - } + changed = gameFileCache.update(gamePaths); + } + if (changed) + { + updateGameFileArray(); + sendBroadcast(CACHE_UPDATED); + } + + boolean additionalMetadataChanged = gameFileCache.updateAdditionalMetadata(); + if (additionalMetadataChanged) + { + updateGameFileArray(); + sendBroadcast(CACHE_UPDATED); + } + + if (changed || additionalMetadataChanged) + { + gameFileCache.save(); } } |
