Closed Bug 1126681 Opened 9 years ago Closed 2 years ago

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

Categories

(Core :: DOM: Content Processes, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: ting, Unassigned)

References

Details

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.
I just realized 'remote-browser-pending' is for nsGenericHTMLFrameElement, it can't be done while pre-creating nsFrameLoader when preallocated process is ready.
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)
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.
See Also: → 1121905
Actually remote-browser-pending is not necessary, frame loader can call nsBrowserElement::InitBrowserElementAPI() directly.
(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.
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)

BrowserElementParent is going away in bug 1770944

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.