Bug 1650118: Part 1 - Remove non-e10s mode from GeckoView; r=geckoview-reviewers,agi
authorAaron Klotz <aklotz@mozilla.com>
Tue, 27 Oct 2020 16:43:29 +0000
changeset 554759 c0ee6278161e49f1473ae787322cf24890144d4f
parent 554758 40c3783a0adf38ae5a9a2addc8e0a20491690757
child 554760 68a0c8b19d88dae0a9cb9da8b59212b337e6df25
push id37898
push userabutkovits@mozilla.com
push dateWed, 28 Oct 2020 09:24:21 +0000
treeherdermozilla-central@83bf4fd3b1fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, agi
bugs1650118
milestone84.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1650118: Part 1 - Remove non-e10s mode from GeckoView; r=geckoview-reviewers,agi Differential Revision: https://phabricator.services.mozilla.com/D90929
mobile/android/app/geckoview-prefs.js
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
toolkit/xre/nsAppRunner.cpp
widget/android/GeckoViewSupport.h
widget/android/nsWindow.cpp
--- a/mobile/android/app/geckoview-prefs.js
+++ b/mobile/android/app/geckoview-prefs.js
@@ -12,16 +12,17 @@
 // Please indent all prefs defined within #ifdef/#ifndef conditions. This
 // improves readability, particular for conditional blocks that exceed a single
 // screen.
 
 #include mobile.js
 
 pref("privacy.trackingprotection.pbmode.enabled", false);
 
+pref("browser.tabs.remote.autostart", true);
 pref("dom.ipc.keepProcessesAlive.web", 1);
 pref("dom.ipc.processCount", 1);
 pref("dom.ipc.processPrelaunch.enabled", false);
 
 // Disable the Telemetry Event Ping
 pref("toolkit.telemetry.eventping.enabled", false);
 // Don't create the hidden window during startup.
 pref("toolkit.lazyHiddenWindow", true);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
@@ -289,20 +289,17 @@ public final class GeckoRuntime implemen
 
         return null;
     }
 
     /* package */ boolean init(final @NonNull Context context, final @NonNull GeckoRuntimeSettings settings) {
         if (DEBUG) {
             Log.d(LOGTAG, "init");
         }
-        int flags = 0;
-        if (settings.getUseMultiprocess()) {
-            flags |= GeckoThread.FLAG_PRELOAD_CHILD;
-        }
+        int flags = GeckoThread.FLAG_PRELOAD_CHILD;
 
         if (settings.getPauseForDebuggerEnabled()) {
             flags |= GeckoThread.FLAG_DEBUGGING;
         }
 
         final Class<?> crashHandler = settings.getCrashHandler();
         if (crashHandler != null) {
             try {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
@@ -41,32 +41,16 @@ public final class GeckoRuntimeSettings 
             extends RuntimeSettings.Builder<GeckoRuntimeSettings> {
         @Override
         protected @NonNull GeckoRuntimeSettings newSettings(
                 final @Nullable GeckoRuntimeSettings settings) {
             return new GeckoRuntimeSettings(settings);
         }
 
         /**
-         * Set whether multiprocess support should be enabled.
-         *
-         * @param use A flag determining whether multiprocess should be enabled.
-         *            Default is true.
-         * @return This Builder instance.
-         *
-         * @deprecated This method will be removed in GeckoView 82, at which point GeckoView will
-         *             only operate in multiprocess mode.
-         */
-        @Deprecated // Bug 1650118
-        public @NonNull Builder useMultiprocess(final boolean use) {
-            getSettings().mUseMultiprocess.set(use);
-            return this;
-        }
-
-        /**
          * Set the custom Gecko process arguments.
          *
          * @param args The Gecko process arguments.
          * @return This Builder instance.
          */
         public @NonNull Builder arguments(final @NonNull String[] args) {
             if (args == null) {
                 throw new IllegalArgumentException("Arguments must not  be null");
@@ -498,18 +482,16 @@ public final class GeckoRuntimeSettings 
     /* package */ final Pref<Boolean> mConsoleServiceToLogcat = new Pref<>(
             "consoleservice.logcat", true);
     /* package */ final Pref<Boolean> mDevToolsConsoleToLogcat = new Pref<>(
             "devtools.console.stdout.chrome", true);
     /* package */ final Pref<Boolean> mAboutConfig = new Pref<>(
             "general.aboutConfig.enable", false);
     /* package */ final Pref<Boolean> mForceUserScalable = new Pref<>(
             "browser.ui.zoom.force-user-scalable", false);
-    /* package */ final Pref<Boolean> mUseMultiprocess = new Pref<>(
-            "browser.tabs.remote.autostart", true);
     /* package */ final Pref<Boolean> mAutofillLogins = new Pref<Boolean>(
         "signon.autofillForms", true);
 
     /* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM;
 
     /* package */ boolean mDebugPause;
     /* package */ boolean mUseMaxScreenDepth;
     /* package */ float mDisplayDensityOverride = -1.0f;
@@ -573,30 +555,16 @@ public final class GeckoRuntimeSettings 
     }
 
     /* package */ void commit() {
         commitLocales();
         commitResetPrefs();
     }
 
     /**
-     * Whether multiprocess is enabled.
-     *
-     * @return true if multiprocess is enabled, false otherwise.
-     *
-     * @deprecated This method will be removed in GeckoView 82, at which point GeckoView will only
-     *             operate in multiprocess mode.
-     */
-    @Deprecated // Bug 1650118
-    public boolean getUseMultiprocess() {
-        return mUseMultiprocess.get();
-    }
-
-
-    /**
      * Get the custom Gecko process arguments.
      *
      * @return The Gecko process arguments.
      */
     public @NonNull String[] getArguments() {
         return mArgs;
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -1026,17 +1026,17 @@ public class GeckoSession {
         }
 
         // Create a new Gecko window and assign an initial set of Java session objects to it.
         @WrapForJNI(dispatchTo = "proxy")
         public static native void open(Window instance, NativeQueue queue,
                                        Compositor compositor, EventDispatcher dispatcher,
                                        SessionAccessibility.NativeProvider sessionAccessibility,
                                        GeckoBundle initData, String id, String chromeUri,
-                                       int screenId, boolean privateMode, boolean isRemote);
+                                       int screenId, boolean privateMode);
 
         @Override // JNIObject
         public void disposeNative() {
             if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
                 nativeDisposeNative();
             } else {
                 GeckoThread.queueNativeCallUntil(GeckoThread.State.PROFILE_READY,
                         this, "nativeDisposeNative");
@@ -1296,41 +1296,40 @@ public class GeckoSession {
         if (isOpen()) {
             // We will leak the existing Window if we open another one.
             throw new IllegalStateException("Session is open");
         }
 
         final String chromeUri = mSettings.getChromeUri();
         final int screenId = mSettings.getScreenId();
         final boolean isPrivate = mSettings.getUsePrivateMode();
-        final boolean isRemote = runtime.getSettings().getUseMultiprocess();
 
         mWindow = new Window(runtime, this, mNativeQueue);
         mWebExtensionController.setRuntime(runtime);
 
         onWindowChanged(WINDOW_OPEN, /* inProgress */ true);
 
         if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
             Window.open(mWindow, mNativeQueue, mCompositor, mEventDispatcher,
                         mAccessibility != null ? mAccessibility.nativeProvider : null,
-                        createInitData(), mId, chromeUri, screenId, isPrivate, isRemote);
+                        createInitData(), mId, chromeUri, screenId, isPrivate);
         } else {
             GeckoThread.queueNativeCallUntil(
                 GeckoThread.State.PROFILE_READY,
                 Window.class, "open",
                 Window.class, mWindow,
                 NativeQueue.class, mNativeQueue,
                 Compositor.class, mCompositor,
                 EventDispatcher.class, mEventDispatcher,
                 SessionAccessibility.NativeProvider.class,
                 mAccessibility != null ? mAccessibility.nativeProvider : null,
                 GeckoBundle.class, createInitData(),
                 String.class, mId,
                 String.class, chromeUri,
-                screenId, isPrivate, isRemote);
+                screenId, isPrivate);
         }
 
         onWindowChanged(WINDOW_OPEN, /* inProgress */ false);
     }
 
     /**
      * Closes the session.
      *
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -551,18 +551,23 @@ bool BrowserTabsRemoteAutostart() {
     }
   } else {
     gBrowserTabsRemoteAutostart = true;
   }
 
   // Uber override pref for emergency blocking
   if (gBrowserTabsRemoteAutostart) {
     const char* forceDisable = PR_GetEnv("MOZ_FORCE_DISABLE_E10S");
+#if defined(MOZ_WIDGET_ANDROID)
+    // We need this for xpcshell on Android
+    if (forceDisable && *forceDisable) {
+#else
     // The environment variable must match the application version to apply.
     if (forceDisable && gAppData && !strcmp(forceDisable, gAppData->version)) {
+#endif
       gBrowserTabsRemoteAutostart = false;
       status = kE10sForceDisabled;
     }
   }
 
   gBrowserTabsRemoteStatus = status;
 
   return gBrowserTabsRemoteAutostart;
--- a/widget/android/GeckoViewSupport.h
+++ b/widget/android/GeckoViewSupport.h
@@ -57,17 +57,17 @@ class GeckoViewSupport final
   // Create and attach a window.
   static void Open(const jni::Class::LocalRef& aCls,
                    java::GeckoSession::Window::Param aWindow,
                    jni::Object::Param aQueue, jni::Object::Param aCompositor,
                    jni::Object::Param aDispatcher,
                    jni::Object::Param aSessionAccessibility,
                    jni::Object::Param aInitData, jni::String::Param aId,
                    jni::String::Param aChromeURI, int32_t aScreenId,
-                   bool aPrivateMode, bool aRemote);
+                   bool aPrivateMode);
 
   // Close and destroy the nsWindow.
   void Close();
 
   // Transfer this nsWindow to new GeckoSession objects.
   void Transfer(const java::GeckoSession::Window::LocalRef& inst,
                 jni::Object::Param aQueue, jni::Object::Param aCompositor,
                 jni::Object::Param aDispatcher,
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1222,18 +1222,17 @@ GeckoViewSupport::~GeckoViewSupport() {
 }
 
 /* static */
 void GeckoViewSupport::Open(
     const jni::Class::LocalRef& aCls, GeckoSession::Window::Param aWindow,
     jni::Object::Param aQueue, jni::Object::Param aCompositor,
     jni::Object::Param aDispatcher, jni::Object::Param aSessionAccessibility,
     jni::Object::Param aInitData, jni::String::Param aId,
-    jni::String::Param aChromeURI, int32_t aScreenId, bool aPrivateMode,
-    bool aRemote) {
+    jni::String::Param aChromeURI, int32_t aScreenId, bool aPrivateMode) {
   MOZ_ASSERT(NS_IsMainThread());
 
   AUTO_PROFILER_LABEL("mozilla::widget::GeckoViewSupport::Open", OTHER);
 
   nsCOMPtr<nsIWindowWatcher> ww = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
   MOZ_RELEASE_ASSERT(ww);
 
   nsAutoCString url;
@@ -1247,23 +1246,20 @@ void GeckoViewSupport::Open(
   }
 
   // Prepare an nsIAndroidView to pass as argument to the window.
   RefPtr<AndroidView> androidView = new AndroidView();
   androidView->mEventDispatcher->Attach(
       java::EventDispatcher::Ref::From(aDispatcher), nullptr);
   androidView->mInitData = java::GeckoBundle::Ref::From(aInitData);
 
-  nsAutoCString chromeFlags("chrome,dialog=0,resizable,scrollbars");
+  nsAutoCString chromeFlags("chrome,dialog=0,remote,resizable,scrollbars");
   if (aPrivateMode) {
     chromeFlags += ",private";
   }
-  if (aRemote) {
-    chromeFlags += ",remote";
-  }
   nsCOMPtr<mozIDOMWindowProxy> domWindow;
   ww->OpenWindow(nullptr, url, nsDependentCString(aId->ToCString().get()),
                  chromeFlags, androidView, getter_AddRefs(domWindow));
   MOZ_RELEASE_ASSERT(domWindow);
 
   nsCOMPtr<nsPIDOMWindowOuter> pdomWindow = nsPIDOMWindowOuter::From(domWindow);
   const RefPtr<nsWindow> window = nsWindow::From(pdomWindow);
   MOZ_ASSERT(window);