Loading core/java/android/webkit/WebViewZygote.java +3 −12 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.webkit; import android.content.pm.PackageInfo; import android.os.AsyncTask; import android.os.Build; import android.os.ChildZygoteProcess; import android.os.Process; Loading Loading @@ -81,17 +80,9 @@ public class WebViewZygote { synchronized (sLock) { sMultiprocessEnabled = enabled; // When toggling between multi-process being on/off, start or stop the // zygote. If it is enabled and the zygote is not yet started, launch it. // Otherwise, kill it. The name may be null if the package information has // not yet been resolved. if (enabled) { // Run on a background thread as this waits for the zygote to start and we don't // want to block the caller on this. It's okay if this is delayed as anyone trying // to use the zygote will call it first anyway. AsyncTask.THREAD_POOL_EXECUTOR.execute(WebViewZygote::getProcess); } else { // No need to run this in the background, it's very brief. // When multi-process is disabled, kill the zygote. When it is enabled, // the zygote will be started when it is first needed in getProcess(). if (!enabled) { stopZygoteLocked(); } } Loading services/core/java/com/android/server/webkit/SystemImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,11 @@ public class SystemImpl implements SystemInterface { WebViewZygote.setMultiprocessEnabled(enableMultiProcess); } @Override public void ensureZygoteStarted() { WebViewZygote.getProcess(); } @Override public boolean isMultiProcessDefaultEnabled() { // Multiprocess is enabled for all 64-bit devices, since the ability to run the renderer Loading services/core/java/com/android/server/webkit/SystemInterface.java +2 −0 Original line number Diff line number Diff line Loading @@ -61,5 +61,7 @@ public interface SystemInterface { public int getMultiProcessSetting(Context context); public void setMultiProcessSetting(Context context, int value); public void notifyZygote(boolean enableMultiProcess); /** Start the zygote if it's not already running. */ public void ensureZygoteStarted(); public boolean isMultiProcessDefaultEnabled(); } services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.pm.PackageInfo; import android.os.AsyncTask; import android.os.UserHandle; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderResponse; Loading Loading @@ -81,6 +82,14 @@ public class WebViewUpdateServiceImpl { migrateFallbackStateOnBoot(); mWebViewUpdater.prepareWebViewInSystemServer(); mSystemInterface.notifyZygote(isMultiProcessEnabled()); AsyncTask.THREAD_POOL_EXECUTOR.execute(this::startZygoteWhenReady); } void startZygoteWhenReady() { // Wait on a background thread for RELRO creation to be done. We ignore the return value // because even if RELRO creation failed we still want to start the zygote. waitForAndGetProvider(); mSystemInterface.ensureZygoteStarted(); } void handleNewUser(int userId) { Loading services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,9 @@ public class TestSystemImpl implements SystemInterface { @Override public void notifyZygote(boolean enableMultiProcess) {} @Override public void ensureZygoteStarted() {} @Override public boolean isMultiProcessDefaultEnabled() { return mMultiProcessDefault; Loading Loading
core/java/android/webkit/WebViewZygote.java +3 −12 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.webkit; import android.content.pm.PackageInfo; import android.os.AsyncTask; import android.os.Build; import android.os.ChildZygoteProcess; import android.os.Process; Loading Loading @@ -81,17 +80,9 @@ public class WebViewZygote { synchronized (sLock) { sMultiprocessEnabled = enabled; // When toggling between multi-process being on/off, start or stop the // zygote. If it is enabled and the zygote is not yet started, launch it. // Otherwise, kill it. The name may be null if the package information has // not yet been resolved. if (enabled) { // Run on a background thread as this waits for the zygote to start and we don't // want to block the caller on this. It's okay if this is delayed as anyone trying // to use the zygote will call it first anyway. AsyncTask.THREAD_POOL_EXECUTOR.execute(WebViewZygote::getProcess); } else { // No need to run this in the background, it's very brief. // When multi-process is disabled, kill the zygote. When it is enabled, // the zygote will be started when it is first needed in getProcess(). if (!enabled) { stopZygoteLocked(); } } Loading
services/core/java/com/android/server/webkit/SystemImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,11 @@ public class SystemImpl implements SystemInterface { WebViewZygote.setMultiprocessEnabled(enableMultiProcess); } @Override public void ensureZygoteStarted() { WebViewZygote.getProcess(); } @Override public boolean isMultiProcessDefaultEnabled() { // Multiprocess is enabled for all 64-bit devices, since the ability to run the renderer Loading
services/core/java/com/android/server/webkit/SystemInterface.java +2 −0 Original line number Diff line number Diff line Loading @@ -61,5 +61,7 @@ public interface SystemInterface { public int getMultiProcessSetting(Context context); public void setMultiProcessSetting(Context context, int value); public void notifyZygote(boolean enableMultiProcess); /** Start the zygote if it's not already running. */ public void ensureZygoteStarted(); public boolean isMultiProcessDefaultEnabled(); }
services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.pm.PackageInfo; import android.os.AsyncTask; import android.os.UserHandle; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderResponse; Loading Loading @@ -81,6 +82,14 @@ public class WebViewUpdateServiceImpl { migrateFallbackStateOnBoot(); mWebViewUpdater.prepareWebViewInSystemServer(); mSystemInterface.notifyZygote(isMultiProcessEnabled()); AsyncTask.THREAD_POOL_EXECUTOR.execute(this::startZygoteWhenReady); } void startZygoteWhenReady() { // Wait on a background thread for RELRO creation to be done. We ignore the return value // because even if RELRO creation failed we still want to start the zygote. waitForAndGetProvider(); mSystemInterface.ensureZygoteStarted(); } void handleNewUser(int userId) { Loading
services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,9 @@ public class TestSystemImpl implements SystemInterface { @Override public void notifyZygote(boolean enableMultiProcess) {} @Override public void ensureZygoteStarted() {} @Override public boolean isMultiProcessDefaultEnabled() { return mMultiProcessDefault; Loading