Closed Bug 1667594 Opened 4 years ago Closed 4 years ago

Reduce the recompile time of nsLayoutUtils.h

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: botond, Assigned: botond)

References

Details

Attachments

(6 files)

Recompiling after a change to nsLayoutUtils.h takes a very long time. I'd like to see if we can reduce that somewhat by including it in fewer places.

This patch covers thw low-hanging fruit: headers that either don't use
nsLayoutUtils.h at all, or where only method implementations that can
easily be moved to the .cpp file use it.

The only thing in nsIFrame.h that was using it was the implementation
of a templated method, which could be moved to nsIFrameInlines.h.

Depends on D91504

nsContainerFrame.h was only using the enum nsLayoutUtils::IntrinsicISizeType,
which this patch moves to LayoutConstants.h instead.

Depends on D91505

Blocks: 1664101

More patches to come.

Keywords: leave-open
Pushed by bballo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7c645b39dd1d
Avoid including nsLayoutUtils.h from various headers. r=kats
https://hg.mozilla.org/integration/autoland/rev/d45caf044f0f
Avoid including nsLayoutUtils.h in nsIFrame.h. r=emilio
https://hg.mozilla.org/integration/autoland/rev/cb8232ebe212
Avoid including nsLayoutUtils.h in nsContainerFrame.h. r=emilio
Regressions: 1667620

It does not appear to be needed.

Along with a dependent struct DirectDrawInfo.

This allows nsImageRenderer.h and CanvasRenderingContext2D.h to
avoid including nsLayoutUtils.h.

For nsImageRenderer.h in particular, a forward declaration is
not sufficient as nsImageRenderer stores SurfaceFromElementResult
by value.

A couple of method definitions elsewhere are moved out of line
to keep things compiling without including nsLayoutUtils.h in
additional headers.

Depends on D91683

This allows it to be forward-declared (while a nested class cannot be),
such that headers files that use RectCallback by pointer or reference
do not need to include nsLayoutUtils.h.

This avoids including nsLayoutUtils.h in nsRange.h.

Depends on D91684

With these patches in place, nsLayoutUtils.h is no longer included by any header files, with two exceptions:

  • nsIFrameInlines.h, which contains a template method definition that uses nsLayoutUtils and therefore cannot be moved into a .cpp file
    • however, this is much less widely included than nsIFrame.h (indeed, this is the purpose of the nsIFrameInlines.h header)
  • InspectorUtils.h, which is only included by two .cpp files

The patches reduce the recompile time after modifying nsLayoutUtils.h on my local machine from 725s to 237s, a 67% reduction.

Keywords: leave-open
Pushed by bballo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b6c8e8cdd6ba
Avoid including nsLayoutUtils.h in WebGLContext.h. r=jgilbert
https://hg.mozilla.org/integration/autoland/rev/ccb08a922676
Move nsLayoutUtils::SurfaceFromElementResult to its own file. r=emilio
https://hg.mozilla.org/integration/autoland/rev/adf38a6442cf
Move nsLayoutUtils::RectCallback to namespace scope. r=emilio,jgilbert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: