Closed Bug 1594820 Opened 4 years ago Closed 4 years ago

Improve asynchronicity of content process startup

Categories

(GeckoView :: Sandboxing, enhancement, P1)

Unspecified
All
enhancement

Tracking

(firefox74 fixed)

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

(Whiteboard: [geckoview:m1911] [geckoview:m1912][geckoview:m74])

Attachments

(4 files)

We need to hook up content process startup to route through the launcher thread. bholley wrote a POC patch, but it was a POC.

There's a bunch of synchronous stuff in GeckoProcessManager that should be made more async.

Priority: -- → P1

Aaron says he will be working on this bug in November.

Whiteboard: [geckoview:m1911]

Note to self: as I do this, I need to be aware of exception handling and making sure that they are caught and routed through GeckoResult.

Type: task → enhancement
Depends on: 1600658
Whiteboard: [geckoview:m1911] → [geckoview:m1911] [geckoview:m1912]

Since XPCOMEventTarget uses JNI, this patch makes it possible for consumers to
retrieve and invoke methods on one without needing to worry about whether JNI
is actually up yet.

To achieve this, we create the IXPCOMEventTarget interface, and observe that
both of its methods can be handled by a proxy if JNI is not ready:

  • Calls to dispatch may be enqueued until JNI is up;
  • Observe that, when JNI is not up yet, the result of isOnCurrentThread
    can never be true.

Once JNI is up and the event targets have been resolved, the proxies are
replaced with the real, concrete XPCOMEventTargets.

This patch adds a Dispatcher implementation that allows us to create
GeckoResults that will dispatch to the XPCOM launcher thread.

Depends on D57837

The primary purpose of this patch is to convert the internal sequence of
service binding and invoking of start to asynchronously run on the XPCOM
launcher thread via GeckoResult. Because more of the code now runs on the same
thread, many of these methods no longer need to be synchronized.

Disconnecting via unbind is also modified to use the launcher thread and
GeckoResult.

Note that no changes have been made yet to enable multiple processes of the
same type; those changes will be made in bug 1595834.

Depends on D57838

Now that everything in GeckoProcessManager runs on the XPCOM launcher thread,
GeckoThread should just call GeckoProcessManager.preload() directly.

Depends on D57839

Attachment #9117048 - Attachment description: Bug 1594820: Part 3 - Modify GeckoProcessManager to bind and start child processes asynchronously on the XPCOM launcher thread; r=#geckoview-reviewers → Bug 1594820: Part 3 - Modify GeckoProcessManager to bind and start child processes asynchronously on the XPCOM launcher thread; r=agi
Whiteboard: [geckoview:m1911] [geckoview:m1912] → [geckoview:m1911] [geckoview:m1912][geckoview:m74]
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b7ff66be3a86
Part 1 - Modify XPCOMEventTarget to accept method calls before JNI is ready; r=snorp
https://hg.mozilla.org/integration/autoland/rev/9cc8d70c23bb
Part 2 - Make GeckoResult compatible with XPCOMEventTarget; r=snorp
https://hg.mozilla.org/integration/autoland/rev/a6554cbe8a2f
Part 3 - Modify GeckoProcessManager to bind and start child processes asynchronously on the XPCOM launcher thread; r=geckoview-reviewers,agi
https://hg.mozilla.org/integration/autoland/rev/5bf29e6ca1e8
Part 4 - Modify GeckoThread.preload to directly call into the process manager; r=geckoview-reviewers,snorp
Flags: needinfo?(aklotz)
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2f6df46484dc
Part 1 - Modify XPCOMEventTarget to accept method calls before JNI is ready; r=snorp
https://hg.mozilla.org/integration/autoland/rev/de9a496180f9
Part 2 - Make GeckoResult compatible with XPCOMEventTarget; r=snorp
https://hg.mozilla.org/integration/autoland/rev/d6d2afaee49d
Part 3 - Modify GeckoProcessManager to bind and start child processes asynchronously on the XPCOM launcher thread; r=geckoview-reviewers,agi
https://hg.mozilla.org/integration/autoland/rev/6fcef35f1cf4
Part 4 - Modify GeckoThread.preload to directly call into the process manager; r=geckoview-reviewers,snorp

Moving content process management bugs to the new GeckoView::Sandboxing component.

Component: General → Sandboxing
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: