[geckoview] Support preloading GeckoView child process

RESOLVED FIXED in Firefox 58

Status

enhancement
RESOLVED FIXED
2 years ago
8 months ago

People

(Reporter: jchen, Assigned: jchen)

Tracking

unspecified
mozilla58
All
Android
Dependency tree / graph

Firefox Tracking Flags

(firefox58 fixed)

Details

Attachments

(4 attachments)

Add an option in GeckoView.preload to preload the e10s child process, so we spend less time waiting for the child process to get ready when it's needed.
Comment on attachment 8914926 [details]
Bug 1404144 - 3. Add flag to preload child process during main GeckoThread startup;

https://reviewboard.mozilla.org/r/186170/#review191400
Attachment #8914926 - Flags: review?(snorp) → review+
Comment on attachment 8914927 [details]
Bug 1404144 - 4. Preload child process in geckoview_example in multiprocess mode;

https://reviewboard.mozilla.org/r/186172/#review191402
Attachment #8914927 - Flags: review?(snorp) → review+
Comment on attachment 8914925 [details]
Bug 1404144 - 2. Move start child process JNI call to GeckoProcessManager;

https://reviewboard.mozilla.org/r/186168/#review191530
Attachment #8914925 - Flags: review?(rbarker) → review+
Comment on attachment 8914924 [details]
Bug 1404144 - 1. Refactor child process code to support preloading;

https://reviewboard.mozilla.org/r/186166/#review191584

The diff makes the patch hard to read, but it looks okay to me.

::: mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoProcessManager.java
(Diff revision 1)
>          @Override
>          public void binderDied() {
> -            Log.e(LOGTAG, "Binder died. Attempt to unbind service: " + mType + " " + mPid);
> +            Log.i(LOGTAG, "Binder died for " + mType);
> -            try {
> -                GeckoAppShell.getApplicationContext().unbindService(this);
> +            GeckoAppShell.getApplicationContext().unbindService(this);
> -            } catch (final java.lang.IllegalArgumentException e) {

Are you not seeing this exception? I don't remember why this try/catch was here but thought it might be because sometimes unbindService would throw if the service had already been unbound?

::: mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoServiceChildProcess.java:100
(Diff revision 1)
>          Log.i(LOGTAG, "Service has been unbound. Stopping.");
> -        stop();
> +        Process.killProcess(Process.myPid());
>          return false;
>      }
>  
> -    @JNITarget
> +    public static final class geckomediaplugin extends GeckoServiceChildProcess {}

I think I marked them @JNITarget to prevent ProGuard from removing them. I guess it isn't an issue?
Attachment #8914924 - Flags: review?(rbarker) → review+
Comment on attachment 8914924 [details]
Bug 1404144 - 1. Refactor child process code to support preloading;

https://reviewboard.mozilla.org/r/186166/#review191584

> Are you not seeing this exception? I don't remember why this try/catch was here but thought it might be because sometimes unbindService would throw if the service had already been unbound?

Yeah reading the source looks like `IllegalArgumentException` is possible, but I think if we're smart with managing states we shouldn't encounter it.

> I think I marked them @JNITarget to prevent ProGuard from removing them. I guess it isn't an issue?

Right, ProGuard doesn't remove public classes.
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5467f3e1c9a8
1. Refactor child process code to support preloading; r=rbarker
https://hg.mozilla.org/integration/autoland/rev/b54db0501532
2. Move start child process JNI call to GeckoProcessManager; r=rbarker
https://hg.mozilla.org/integration/autoland/rev/dbfa1f3407f1
3. Add flag to preload child process during main GeckoThread startup; r=snorp
https://hg.mozilla.org/integration/autoland/rev/1628829b6082
4. Preload child process in geckoview_example in multiprocess mode; r=snorp
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 58 → mozilla58
You need to log in before you can comment on or make changes to this bug.