Closed Bug 1350734 Opened 7 years ago Closed 7 years ago

Load xul.css lazily in the content process

Categories

(Core :: Layout, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: jwatt)

References

Details

Attachments

(1 file, 1 obsolete file)

nsDocumentViewer::CreateStyleSet() takes 11ms in this profile: <https://perfht.ml/2nq6PxV>  It seems like we should be able to get away with loading xul.css lazily in the content process, since unless you use video controls or the like xul-minimal.css should be enough.

Bug 1008455 did some of the work needed but not enough.  This logic needs to be made parent only: <http://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/layout/style/nsLayoutStylesheetCache.cpp#341>
Assignee: nobody → jwatt
(In reply to :Ehsan Akhgari (busy) from comment #0)
> Bug 1008455 did some of the work needed but not enough.

Well, it avoided any unnecessary per-document work to process xul.css rules, and back then there was no reason to avoid the once-per-process overhead of creating the cached xul.css sheet since we knew we were going to need that to display the UI. ;)

But yeah, nowadays we should avoid this for the content process to speed up tab opening when opening a tab requires us to start a new content process.
Attached patch patch (obsolete) — Splinter Review
Attachment #8851545 - Flags: review?(cam)
Attached patch patchSplinter Review
Attachment #8851545 - Attachment is obsolete: true
Attachment #8851545 - Flags: review?(cam)
Attachment #8851547 - Flags: review?(cam)
Comment on attachment 8851547 [details] [diff] [review]
patch

Review of attachment 8851547 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/style/nsLayoutStylesheetCache.cpp
@@ +150,5 @@
> +  if (!mXULSheet) {
> +    LoadSheetURL("chrome://global/content/xul.css",
> +                 &mXULSheet, eAgentSheetFeatures, eCrash);
> +  }
> + 

Nit: Trailing space.

@@ +344,5 @@
>    LoadSheetURL("resource://gre/res/svg.css",
>                 &mSVGSheet, eAgentSheetFeatures, eCrash);
> +  if (XRE_IsParentProcess()) {
> +    // We know we need this for the UI
> +    LoadSheetURL("chrome://global/content/xul.css",

Just call XULSheet().
Attachment #8851547 - Flags: review?(cam) → review+
Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8000f47b7399
Have nsLayoutStylesheetCache load xul.css lazily in the content process. r=heycam
https://hg.mozilla.org/mozilla-central/rev/8000f47b7399
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: