diff options
| author | JosJuice <josjuice@gmail.com> | 2021-08-24 14:36:08 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-08-24 14:56:33 +0200 |
| commit | bba33c7cede68259c7f2b05e9964960d9e2570e4 (patch) | |
| tree | 212696d05443b0149f6b1fa8efc86d2844c4ef34 /Source/Android/jni/GameList/GameFileCache.cpp | |
| parent | 757985d4c28745ca62500da0ed32cd164587d491 (diff) | |
Android: Don't hold gameFileCache lock while finding games
FindAllGamePaths may take a little while, and holding the
gameFileCache lock isn't actually necessary until it's time to
put the results returned by FindAllGamePaths into gameFileCache.
The downside of this change is that we have to do an extra
round of JNI in between FindAllGamePaths and Update,
but I don't think that's much of a problem.
Diffstat (limited to 'Source/Android/jni/GameList/GameFileCache.cpp')
| -rw-r--r-- | Source/Android/jni/GameList/GameFileCache.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Android/jni/GameList/GameFileCache.cpp b/Source/Android/jni/GameList/GameFileCache.cpp index 06329a70ac..b79d85db15 100644 --- a/Source/Android/jni/GameList/GameFileCache.cpp +++ b/Source/Android/jni/GameList/GameFileCache.cpp @@ -38,6 +38,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finali delete GetPointer(env, obj); } +JNIEXPORT jobjectArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGamePaths( + JNIEnv* env, jclass, jobjectArray folder_paths, jboolean recursive_scan) +{ + return VectorToJStringArray( + env, UICommon::FindAllGamePaths(JStringArrayToVector(env, folder_paths), recursive_scan)); +} + JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_getSize(JNIEnv* env, jobject obj) { @@ -66,10 +73,9 @@ JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_add } JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update( - JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan) + JNIEnv* env, jobject obj, jobjectArray game_paths) { - return GetPointer(env, obj)->Update( - UICommon::FindAllGamePaths(JStringArrayToVector(env, folder_paths), recursive_scan)); + return GetPointer(env, obj)->Update(JStringArrayToVector(env, game_paths)); } JNIEXPORT jboolean JNICALL |
