Closed Bug 920448 Opened 11 years ago Closed 6 years ago

Preload more TabChild

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: vingtetun, Unassigned)

References

Details

Right now when a new process is prelaunch, it is designed to have only one TabChild. This hurts opening any new window since dom/ipc/preload.js will not be loaded for the new outer window.

It happens right now for:
 - every time the call screen is opened
 - If you open the dialer app when the contacts app is already opened or vice versa
 - For each inline activity if their respective application is already opened

Preloading multiple TabChild will likely results into an extra memory consumption. I wonder if Nuwa will help here if those are opened into the template process does their memory will be shared until someone use them?
3 or 4 TabChilds sounds a reasonable number to me if we end up reusing those in the front end side.
To clarify, do you mean it's preferable to have multiple preallocated processes like such in b2g-ps?

(Preallocated a  root      30452 30292 58648  18856 ffffffff 401444e0 S /system/b2g/plugin-container
(Preallocated a  root      30462 30292 58648  18856 ffffffff 401444e0 S /system/b2g/plugin-container
(Preallocated a  root      30486 30292 58648  18856 ffffffff 401444e0 S /system/b2g/plugin-container

If yes, then I think Nuwa is going to help since it will make these preallocated processes consume less memory than what we have now.
(In reply to Cervantes Yu from comment #2)
> To clarify, do you mean it's preferable to have multiple preallocated
> processes like such in b2g-ps?
> 

Nope. I would like multiple TabChild preloaded into the template process. 

My understanding is that for one process there is one ContentChild that can contains multiple TabChild.

Then every time an <iframe mozapp> is opened in the Gaia system application, a new TabChild is created. 

This TabChild contains all kind of things like a BrowserElementChild and all its dependencies (see http://mxr.mozilla.org/mozilla-central/source/dom/browser-element/BrowserElementChild.js). 

Also initializing the TabChild is expensive, so in order to speed up the loading of apps there is currently a preloaded process contains a 'prepared' TabChild. I say 'prepared' because we currently load http://mxr.mozilla.org/mozilla-central/source/dom/ipc/preload.js in order to preload some of necessary parts needed for each window.

So it works well when apps have only one window, but some apps like the dialer, can have multiple windows (the call screen is an additional window for example) and in this case we don't benefit from the 'prepared' TabChild since it is already in use and a new TabChild needs to be created from scratch. And this is expensive again!

So I would like to prepare 3 or 4 TabChild into PreloadSlowThings() once the template process supports it. And my hope is that the extra memory consume for those TabChilds will be cheap because of the template process if one application needs only one window.

I hope my explanation is understandable?
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #3)
> (In reply to Cervantes Yu from comment #2)
> > To clarify, do you mean it's preferable to have multiple preallocated
> > processes like such in b2g-ps?
> > 
> 
> Nope. I would like multiple TabChild preloaded into the template process. 
> 
OK, I got what you mean. At first thought I think this is doable in the Nuwa process. We just need to avoid the pitfalls. The main pitfall is don't schedule timer or cause gc after the relevant threads are frozen.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.