Closed
Bug 189077
Opened 22 years ago
Closed 22 years ago
Make nsImageFrame smaller
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla1.4alpha
People
(Reporter: hjtoi-bugzilla, Assigned: hjtoi-bugzilla)
Details
(Keywords: memory-footprint)
Attachments
(1 file, 2 obsolete files)
9.40 KB,
patch
|
paper
:
review+
roc
:
superreview+
asa
:
approval1.3b-
|
Details | Diff | Splinter Review |
nsImageFrame has 6 PRPackedBool member variables. We can save a little space by concerting them into a single variable and using its bits as truth values instead.
Assignee | ||
Comment 1•22 years ago
|
||
Assignee | ||
Updated•22 years ago
|
Attachment #111536 -
Flags: superreview?(bzbarsky)
Attachment #111536 -
Flags: review?(dbaron)
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [fixinhand]
Target Milestone: --- → mozilla1.3beta
If you're going to use bits, why not use the 12 high frame state bits (of mState) that are already there, reserved for implementations of nsIFrame? See http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/base/public/nsIFrame.h&rev=3.213&mark=226-228#216
Assignee | ||
Comment 3•22 years ago
|
||
I have some concerns about this, and I have not yet fully investigated what is happening. Maybe you who have more experience with layout can answer these... 1. nsImageFrame needs to set one bit in the constructor. But it was not previously doing anything with mState in the constructor, so somebody else does that. How can I ensure that the bit I set remains? I tested setting the value of mState to my bit, and that apparently worked but I don't know if there are subtle errors. If I just tried to |= my bit, mozilla.org did not lay out correctly and I got assertions. 2. Is my usage of the high bits safe (I am not stomping on anyone's bits and nobody is stomping on my bits)?
> If I just tried to |= my bit, mozilla.org did not lay out > correctly and I got assertions. Weird. Because frames are created with a zeroing |new| and so using "=" and "|=" right at initialization should be the same (unelss frames don't use a zeroing |new| anymore?). > How can I ensure that the bit I set remains? [...] > 2. Is my usage of the high bits safe (I am not stomping on anyone's bits and > nobody is stomping on my bits)? Both questions are the same. If you are inheriting from somebody or somebody is inheriting from you, then the contract is that you honour the bits owned by others below you. So, repeating, this means that the inheritance chain is therefore safe.
Assignee | ||
Comment 5•22 years ago
|
||
It seems the broken layout was a fluke, I have not been able to reproduce. This patch seems to work, and I am just flipping a bit in mState and not stomping the whole value in the constructor.
Attachment #111536 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Attachment #111991 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Attachment #112424 -
Flags: superreview?(roc+moz)
Attachment #112424 -
Flags: review?(dbaron)
Assignee | ||
Updated•22 years ago
|
Attachment #111536 -
Flags: superreview?(bzbarsky)
Attachment #111536 -
Flags: review?(dbaron)
Comment on attachment 112424 [details] [diff] [review] Final (?) fix sr=roc+moz looks good You could get Paper (aaronm) to review this if dbaron's too busy.
Attachment #112424 -
Flags: superreview?(roc+moz) → superreview+
Comment on attachment 112424 [details] [diff] [review] Final (?) fix sr=roc+moz looks good
Comment 8•22 years ago
|
||
Comment on attachment 112424 [details] [diff] [review] Final (?) fix nothing but smaller goodness here :)
Attachment #112424 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 9•22 years ago
|
||
Comment on attachment 112424 [details] [diff] [review] Final (?) fix Made nsImageFrame use the frame state bits for its state, which allowed me to get rid of members that were needlessly bloating the class. I have run the precheckin tests and have had this change in my tree for a while and I haven't noticed any problems. Risks: typo nobody has noticed, or somebody else uses these exact bits in the frame state that I din't notice. I think the risks are very low.
Attachment #112424 -
Flags: approval1.3b?
Comment 10•22 years ago
|
||
Comment on attachment 112424 [details] [diff] [review] Final (?) fix Please hold this cleanup until we open for 1.4alpha. Thanks.
Attachment #112424 -
Flags: approval1.3b? → approval1.3b-
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.3beta → mozilla1.4alpha
Assignee | ||
Comment 11•22 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Whiteboard: [fixinhand]
Comment 12•21 years ago
|
||
eep. See bug 83774 (nsImageFrame is down to _3_ PRPackedBools there.....)
Assignee | ||
Comment 13•21 years ago
|
||
But now we have zero (0) PRPackedBools, so this is smaller. Or am I missing something?
Comment 14•21 years ago
|
||
Hm.... it is indeed 4 bytes smaller. I'd missed the fact that you moved all that stuff into the frame state instead of adding another bitfield. OK.
You need to log in
before you can comment on or make changes to this bug.
Description
•