Pre-create/initialize nsFrameLoader and TabParent once preallocated process is ready (~10ms)

NEW
Unassigned

Status

()

defect
4 years ago
9 months ago

People

(Reporter: ting, Unassigned)

Tracking

Trunk
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
As a nsFrameLoader and a TabParent are required whenever an application is launched, we can precreate them and initialize BrowserElementParent once preallocated process is ready.

Based on the profile at bug 1110624 comment 6, this can save us ~20ms from avoiding TryRemoteBrowser() and 'remote-brownser-pending' notification in nsFrmaeLoader::ReallyStartLoadingInternal().

Note: I was thinking to pre-create an iframe from system app (bug 939695), but TabContext can't be updated once it is initialized, so probably doing this in Gecko is better.
(Reporter)

Comment 1

4 years ago
I just realized 'remote-browser-pending' is for nsGenericHTMLFrameElement, it can't be done while pre-creating nsFrameLoader when preallocated process is ready.
(Reporter)

Comment 2

4 years ago
Without doing 'remote-browser-pending' to initialize browser element API earlier, we can save only ~10ms.
Summary: Pre-create/initialize nsFrameLoader and TabParent once preallocated process is ready (~20ms) → Pre-create/initialize nsFrameLoader and TabParent once preallocated process is ready (~10ms)
(Reporter)

Comment 3

4 years ago
Kanru just reminded me that we can still initialize the browser element API and set frame loader before creating an iframe, remote-brwoser-pending is notified before TryRemoteBrowser() is because we want to make sure the hello from child process will be received.
(Reporter)

Updated

4 years ago
See Also: → 1121905
(Reporter)

Comment 4

4 years ago
Actually remote-browser-pending is not necessary, frame loader can call nsBrowserElement::InitBrowserElementAPI() directly.
(Reporter)

Comment 5

4 years ago
(In reply to Ting-Yu Chou [:ting] from comment #3)
> Kanru just reminded me that we can still initialize the browser element API
> and set frame loader before creating an iframe, remote-brwoser-pending is
> notified before TryRemoteBrowser() is because we want to make sure the hello
> from child process will be received.

I am not sure is this true. BrowserElementParent gets message manager from the frame loader to add listeners, but seems nsFrameLoader::EnsureMessageManager() needs owner element to behave correctly.
(Reporter)

Updated

4 years ago
Blocks: 1110624
No longer blocks: AppStartup
FYI, I'm likely to implement swapping TabParent or re-initialize nsFrameLoader for session restore (bug 1033999) and process isolation (bug 1170894)
You need to log in before you can comment on or make changes to this bug.