Merge "Restart the WebView zygote after a WebView update."

This commit is contained in:
TreeHugger Robot
2020-11-06 22:22:30 +00:00
committed by Android (Google) Code Review

View File

@@ -163,6 +163,7 @@ class WebViewUpdateServiceImpl {
}
void prepareWebViewInSystemServer() {
mSystemInterface.notifyZygote(isMultiProcessEnabled());
try {
synchronized (mLock) {
mCurrentWebViewPackage = findPreferredWebViewPackage();
@@ -199,12 +200,6 @@ class WebViewUpdateServiceImpl {
Slog.e(TAG, "No valid provider and no fallback available.");
}
}
boolean multiProcessEnabled = isMultiProcessEnabled();
mSystemInterface.notifyZygote(multiProcessEnabled);
if (multiProcessEnabled) {
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::startZygoteWhenReady);
}
}
private void startZygoteWhenReady() {
@@ -358,6 +353,12 @@ class WebViewUpdateServiceImpl {
mWebViewPackageDirty = true;
}
}
// Once we've notified the system that the provider has changed and started RELRO creation,
// try to restart the zygote so that it will be ready when apps use it.
if (isMultiProcessEnabled()) {
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::startZygoteWhenReady);
}
}
/**