Open Bug 1332454 Opened 7 years ago Updated 2 years ago

Convert nsDocumentViewer and nsPresContext's member-variable flags from 'unsigned' to 'bool', and group them together for better likelihood of packing

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

Details

nsDocumentViewer.cpp has a bunch of one-bit flags like so:
  unsigned      mStopped : 1;
  unsigned      mLoaded : 1;

These are representing boolean values, but we've got them as "unsigned" for historical reasons.

We should replace "unsigned" with "bool" here, so that we're a little more kosher in using them as bools (and assigning them to "true" and "false" bool values, etc).  Similar to bug 1317203.

There are also a few "bool" member variables at the end of the class, too (starting with mIsPageMode) -- we should probably make those explicitly 1-bit as well, for consistency, and we should group all the booleans together (probably shifting the later ones up to join the earlier ones, for better likelihood of packing nicely with the "int16_t" members before those earlier booleans.
https://dxr.mozilla.org/mozilla-central/rev/96cb95af530477edb66ae48d98c18533476e57bb/layout/base/nsDocumentViewer.cpp#366
[sorry for the useless bug-summary; fixing]
Summary: PresShell → Convert nsDocumentViewer.cpp flags from 'unsigned' to 'bool', and group them together for better likelihood of packing
Looks like nsPresContext (defined in nsPresContext.h) could use the same treatment -- it's got a bunch of "unsigned mFoo : 1;" member variables, too.

We could fix that in this bug, or in a separate bug; doesn't much matter. We should wait until bug 1232696's fix has landed to avoid causing bitrot there, though.
Depends on: 1232696
Summary: Convert nsDocumentViewer.cpp flags from 'unsigned' to 'bool', and group them together for better likelihood of packing → Convert nsDocumentViewer and nsPresContext's member-variable flags from 'unsigned' to 'bool', and group them together for better likelihood of packing
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.