Open Bug 1152262 Opened 9 years ago Updated 2 years ago

Instrument the refresh driver to find out which pages eat CPU

Categories

(Core :: Layout, defect)

defect

Tracking

()

Tracking Status
firefox40 --- affected

People

(Reporter: Yoric, Unassigned)

References

(Blocks 1 open bug)

Details

      No description provided.
Spinoff from bug 1149324.

If I understand correctly, the idea would be to instrument nsRefreshDriver::Tick() as follows:
- if we don't have a docShell, nothing to do;
- if we are not in a toplevel docShell, nothing to do;
- otherwise, simply measure the time spent executing this method and somehow charge it to the docShell (and/or its attached JSCompartment).

Is that correct?
Blocks: 1149324
Depends on: 1149486
No longer depends on: 1149324
Flags: needinfo?(dbaron)
(In reply to David Rajchenbach-Teller [:Yoric] (use "needinfo") from comment #1)
> If I understand correctly, the idea would be to instrument
> nsRefreshDriver::Tick() as follows:
> - if we don't have a docShell, nothing to do;
> - if we are not in a toplevel docShell, nothing to do;
> - otherwise, simply measure the time spent executing this method and somehow
> charge it to the docShell (and/or its attached JSCompartment).
> 
> Is that correct?

I think we'd want to find someplace appropriate to charge the time to no matter what -- the refresh driver should always have an mPresContext (unless it hits the early return 10 lines in), and the pres context should always have an mDocument, which should always have a window.  I guess if one of those isn't true I'm probably not too worried, although maybe there's an interesting case like refresh drivers for SVG resource documents.  (ni? :heycam to fill in the situation there, since I've forgotten)
Flags: needinfo?(dbaron) → needinfo?(cam)
I don't recall how windows/docshells work for SVG image documents and their resource documents -- Daniel/Seth?
Flags: needinfo?(seth)
Flags: needinfo?(dholbert)
Flags: needinfo?(cam)
IIRC, the refresh driver should be disabled inside SVG-as-an-image. They update based on pings from their host document's refresh driver, via imgIContainer::RequestRefresh. (This lets them avoid painting in background documents)

SVG-in-opentype is one special case, though -- the glyphs there *do* have an internal refresh driver, because we haven't yet burrowed a RequestRefresh-type channel from the document through the font to the opentype glyphs. See Bug 1107252 comment 3 for more.

(I don't recall how this works for resource documents that are pulled in for filters/clip-regions -- whether those documents have their own refresh driver or what.)
Flags: needinfo?(dholbert)
(In reply to Daniel Holbert [:dholbert] from comment #4)
> the refresh driver should be disabled inside SVG-as-an-image. They
> update based on pings from their host document's refresh driver, via
> imgIContainer::RequestRefresh. (This lets them avoid painting in background
> documents)

s/painting/updating animations/.  This is how we throttle animated GIFs/PNGs, too, BTW. (This work happened for SVG-as-an-image in bug 1002632.)
Flags: needinfo?(seth)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.