Commit 9df5d149 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Android/KitKat: clean up extracted files earlier

On Android KitKat, the native library must be extracted manually
from the APK file. All library files are extracted, and then after
the native library is identified, the unused libraries are cleaned
up. This CL changes this cleanup to happen on a java thread rather
than doing a PostTask, which waits for native library loading to
finish.

There is no reason to wait for the native load to do this cleanup,
and in addition waiting for native loading has made the
EarlyTraceEvent tests flake (see the bug).

Bug: 930174
Change-Id: Iad417e6d7e535ff1b735ab955086e913f622fd2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605682Reviewed-by: default avatarDavid Turner <digit@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Auto-Submit: Matthew Cary <mattcary@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658717}
parent ee7e175d
...@@ -620,9 +620,9 @@ public class LibraryLoader { ...@@ -620,9 +620,9 @@ public class LibraryLoader {
if (processType == LibraryProcessType.PROCESS_BROWSER if (processType == LibraryProcessType.PROCESS_BROWSER
&& PLATFORM_REQUIRES_NATIVE_FALLBACK_EXTRACTION) { && PLATFORM_REQUIRES_NATIVE_FALLBACK_EXTRACTION) {
// Perform the detection and deletion of obsolete native libraries on a background // Perform the detection and deletion of obsolete native libraries on a
// background thread. // background thread.
PostTask.postTask(TaskTraits.BEST_EFFORT_MAY_BLOCK, () -> { new Thread(() -> {
final String suffix = BuildInfo.getInstance().extractedFileSuffix; final String suffix = BuildInfo.getInstance().extractedFileSuffix;
final File[] files = getLibraryDir().listFiles(); final File[] files = getLibraryDir().listFiles();
if (files == null) return; if (files == null) return;
...@@ -645,7 +645,7 @@ public class LibraryLoader { ...@@ -645,7 +645,7 @@ public class LibraryLoader {
} }
} }
} }
}); }).start();
} }
// From this point on, native code is ready to use and checkIsReady() // From this point on, native code is ready to use and checkIsReady()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment