Closed Bug 1397815 Opened 7 years ago Closed 7 years ago

stylo: Need memory reporting for button frame's mInnerFocusStyle

Categories

(Core :: CSS Parsing and Computation, enhancement, P4)

53 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- wontfix
firefox58 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Is there any reason to not make nsIFrame::AddSizeOfExcludingThisForTree virtual, so subclasses can easily report stuff?
Flags: needinfo?(n.nethercote)
Oh, and see bug 1397380 comment 8 item 4.
Blocks: 1397380
Priority: -- → P4
(In reply to Boris Zbarsky [:bz] (still digging out from vacation mail) from comment #0) > Is there any reason to not make nsIFrame::AddSizeOfExcludingThisForTree > virtual, so subclasses can easily report stuff? The only subclass of nsIFrame I can see is nsBox. And I don't see how nsButtonFrameRenderer is related. What am I missing?
Flags: needinfo?(n.nethercote) → needinfo?(bzbarsky)
(In reply to Nicholas Nethercote [:njn] from comment #2) > (In reply to Boris Zbarsky [:bz] (still digging out from vacation mail) from > comment #0) > > Is there any reason to not make nsIFrame::AddSizeOfExcludingThisForTree > > virtual, so subclasses can easily report stuff? > > The only subclass of nsIFrame I can see is nsBox. And I don't see how > nsButtonFrameRenderer is related. What am I missing? nsIFrame has tons of subclasses... 154 instances from DXR: https://dxr.mozilla.org/mozilla-central/search?q=%2Bderived%3AnsIFrame
> And I don't see how nsButtonFrameRenderer is related. What am I missing? The nsButtonFrameRenderer lives in the mRenderer member of nsHTMLButtonControlFrame, whose inheritance chain looks like this: nsHTMLButtonControlFrame -> nsContainerFrame -> nsSplittableFrame -> nsFrame -> nsBox -> nsIFrame If we want to memory-report things hanging off the nsButtonFrameRenderer, we need to reach it from memory-reporting code somehow. One way is to do it while we're doing our frametree walk anyway in AddSizeOfExcludingThisForTree, but that involves making that method virtual, or adding a virtual hook to it, or explicitly checking for a button control frame in the method and calling something on it. We could also look into other ways to register an nsButtonFrameRenderer or nsHTMLButtonControlFrame with memory-reporting code, of course...
Flags: needinfo?(bzbarsky) → needinfo?(n.nethercote)
(In reply to Boris Zbarsky [:bz] (still digging out from vacation mail) from comment #0) > Is there any reason to not make nsIFrame::AddSizeOfExcludingThisForTree > virtual, so subclasses can easily report stuff? No. We have other similar classes where *SizeOf* functions are virtual.
Flags: needinfo?(n.nethercote)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8917956 [details] [diff] [review] Add memory reporting for button frame's mInnerFocusStyle and other additional style contexts Review of attachment 8917956 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsFrame.cpp @@ +10717,5 @@ > } > + > + // And our additional style contexts. > + int32_t index = 0; > + while (auto* extra = GetAdditionalStyleContext(index++)->AsServo()) { AsServo dereferences the pointer in debug builds, so I'm not sure this will work as such. With that fixed, like: while (auto* extra = GetAdditionalStylecontext(index++)) { // ... extra->AsServo()->AddSizeOfIncludingThis(aSizes, ...) } r=me
Attachment #8917956 - Flags: review?(emilio) → review+
Good catch!
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/b109053be6ac Add memory reporting for button frame's mInnerFocusStyle and other additional style contexts. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: