On 13/07/2018 04:55, Randell Jesup wrote: > Correct - we need to have observers/what-have-you for > background/foreground state (and we may want an intermediate state or > two - foreground-but-not-focused (for example a visible window that > isn't the focused window); recently-in-foreground (switching back and > forth); background-for-longer-than-delta, etc. > > Modules can use these to drop caches, shut down unnecessary threads, > change strategies, force GCs/CCs, etc. > > Some of this certainly already exists, but may need to be extended (and > used a lot more).
We already had most of this stuff in the ProcessPriorityManager [1] which has be only ever used in Firefox OS. Since we had one-process-per-tab there it was designed that way so it might need some reworking to deal with one tab consisting of multiple content processes. Also note that dealing with the "importance" of a page is not just a matter of visibility and focus. There are other factors to take into account such as if the page is playing audio or video (like listening to music on YouTube), if it's self-updating and so on. The only mechanism to reduce memory consumption we have now is memory-pressure events which while functional are still under-used. We might also need more fine grained mechanisms than "drop as much memory as you can". Gabriele [1] https://searchfox.org/mozilla-central/rev/46292b1212d2d61d7b5a7df184406774727085b8/dom/ipc/ProcessPriorityManager.cpp
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform