Fix for bug 115157 -- shrink data structures by converting PRBool to PRPackedBool. r=dp, sr=waterson

This commit is contained in:
sfraser%netscape.com 2001-12-14 23:10:42 +00:00
parent 24653793a6
commit 169c79e50d
12 changed files with 55 additions and 44 deletions

View File

@ -103,13 +103,13 @@ class nsHTMLContentSerializer : public nsXMLContentSerializer {
PRInt32 mIndent; PRInt32 mIndent;
PRInt32 mColPos; PRInt32 mColPos;
PRBool mInBody;
PRUint32 mFlags; PRUint32 mFlags;
PRPackedBool mInBody;
PRBool mDoFormat; PRPackedBool mDoFormat;
PRBool mDoHeader; PRPackedBool mDoHeader;
PRBool mBodyOnly; PRPackedBool mBodyOnly;
PRInt32 mPreLevel; PRInt32 mPreLevel;
/* /*
* mInCDATA is set to PR_TRUE while the serializer is serializing * mInCDATA is set to PR_TRUE while the serializer is serializing
@ -120,14 +120,13 @@ class nsHTMLContentSerializer : public nsXMLContentSerializer {
* output the content of the element without doing any entity encoding * output the content of the element without doing any entity encoding
* what so ever. * what so ever.
*/ */
PRBool mInCDATA; PRPackedBool mInCDATA;
PRPackedBool mIsLatin1;
PRInt32 mMaxColumn; PRInt32 mMaxColumn;
nsString mLineBreak; nsString mLineBreak;
PRBool mIsLatin1;
nsCOMPtr<nsIAtom> mCharSet; nsCOMPtr<nsIAtom> mCharSet;
}; };

View File

@ -195,11 +195,14 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && prefs) { if (NS_SUCCEEDED(rv) && prefs) {
if(mFlags & nsIDocumentEncoder::OutputFormatted) { if(mFlags & nsIDocumentEncoder::OutputFormatted) {
PRBool tempBool;
// Get some prefs that controls how we do formatted output // Get some prefs that controls how we do formatted output
prefs->GetBoolPref(PREF_STRUCTS, &mStructs); prefs->GetBoolPref(PREF_STRUCTS, &tempBool);
mStructs = tempBool;
prefs->GetIntPref(PREF_HEADER_STRATEGY, &mHeaderStrategy); prefs->GetIntPref(PREF_HEADER_STRATEGY, &mHeaderStrategy);
// The quotesPreformatted pref is a temporary measure. See bug 69638. // The quotesPreformatted pref is a temporary measure. See bug 69638.
prefs->GetBoolPref("editor.quotesPreformatted", &mQuotesPreformatted); prefs->GetBoolPref("editor.quotesPreformatted", &tempBool);
mQuotesPreformatted = tempBool;
} }
// XXX We should let the caller pass this in. // XXX We should let the caller pass this in.

View File

@ -164,13 +164,16 @@ protected:
protected: protected:
nsString mCurrentLine; nsString mCurrentLine;
PRBool mInHead; PRPackedBool mInHead;
PRPackedBool mAtFirstColumn;
PRPackedBool mQuotesPreformatted; // (pref)
PRPackedBool mStructs; // Output structs (pref)
PRInt32 mIndent; PRInt32 mIndent;
// mInIndentString keeps a header that has to be written in the indent. // mInIndentString keeps a header that has to be written in the indent.
// That could be, for instance, the bullet in a bulleted list. // That could be, for instance, the bullet in a bulleted list.
nsString mInIndentString; nsString mInIndentString;
PRInt32 mCiteQuoteLevel; PRInt32 mCiteQuoteLevel;
PRBool mAtFirstColumn;
PRInt32 mFlags; PRInt32 mFlags;
// The wrap column is how many standard sized chars (western languages) // The wrap column is how many standard sized chars (western languages)
@ -184,18 +187,17 @@ protected:
// Treat quoted text as though it's preformatted -- don't wrap it. // Treat quoted text as though it's preformatted -- don't wrap it.
// Having it on a pref is a temporary measure, See bug 69638. // Having it on a pref is a temporary measure, See bug 69638.
PRInt32 mSpanLevel; PRInt32 mSpanLevel;
PRBool mQuotesPreformatted;
PRBool mDoFragment;
PRInt32 mEmptyLines; // Will be the number of empty lines before PRInt32 mEmptyLines; // Will be the number of empty lines before
// the current. 0 if we are starting a new // the current. 0 if we are starting a new
// line and -1 if we are in a line. // line and -1 if we are in a line.
PRBool mInWhitespace;
PRBool mPreFormatted; PRPackedBool mInWhitespace;
PRBool mStartedOutput; // we've produced at least a character PRPackedBool mPreFormatted;
PRPackedBool mStartedOutput; // we've produced at least a character
nsString mURL; nsString mURL;
PRBool mStructs; // Output structs (pref)
PRInt32 mHeaderStrategy; /* Header strategy (pref) PRInt32 mHeaderStrategy; /* Header strategy (pref)
0 = no indention 0 = no indention
1 = indention, increased with 1 = indention, increased with

View File

@ -164,13 +164,20 @@ public:
static NS_METHOD TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartOffset, PRInt32 aEndOffset, PRInt32 aReplaceLength); static NS_METHOD TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartOffset, PRInt32 aEndOffset, PRInt32 aReplaceLength);
//private: I wish VC++ would give me a &&*@!#$ break protected:
PRBool mIsPositioned;
PRBool mIsDetached; PRPackedBool mBeforeGenContent;
PRPackedBool mAfterGenContent;
PRPackedBool mIsPositioned;
PRPackedBool mIsDetached;
PRInt32 mStartOffset; PRInt32 mStartOffset;
PRInt32 mEndOffset; PRInt32 mEndOffset;
nsCOMPtr<nsIDOMNode> mStartParent; nsCOMPtr<nsIDOMNode> mStartParent;
nsCOMPtr<nsIDOMNode> mEndParent; nsCOMPtr<nsIDOMNode> mEndParent;
static PRMonitor *mMonitor; // monitor to protect the following statics static PRMonitor *mMonitor; // monitor to protect the following statics
static nsVoidArray *mStartAncestors; // just keeping these static to avoid reallocing the arrays. static nsVoidArray *mStartAncestors; // just keeping these static to avoid reallocing the arrays.
static nsVoidArray *mEndAncestors; // the contents of these arrays are discarded across calls. static nsVoidArray *mEndAncestors; // the contents of these arrays are discarded across calls.
@ -181,6 +188,7 @@ public:
nsRange(const nsRange&); nsRange(const nsRange&);
nsRange& operator=(const nsRange&); nsRange& operator=(const nsRange&);
public:
// helper routines // helper routines
static PRBool InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2); static PRBool InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
@ -204,6 +212,7 @@ public:
nsIDOMDocumentFragment* docfrag, nsIDOMDocumentFragment* docfrag,
PRBool leftP); PRBool leftP);
protected:
nsresult DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset, nsresult DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
nsIDOMNode* aEndN, PRInt32 aEndOffset); nsIDOMNode* aEndN, PRInt32 aEndOffset);
@ -220,10 +229,6 @@ public:
nsresult ContentOwnsUs(nsIDOMNode* domNode); nsresult ContentOwnsUs(nsIDOMNode* domNode);
protected:
PRBool mBeforeGenContent;
PRBool mAfterGenContent;
}; };
// Make a new nsIDOMRange object // Make a new nsIDOMRange object

View File

@ -163,7 +163,6 @@ public:
nsIContent* mOwningElement; nsIContent* mOwningElement;
nsIParser* mParserToUnblock; nsIParser* mParserToUnblock;
PRBool mDidBlockParser;
nsICSSStyleSheet* mParentSheet; nsICSSStyleSheet* mParentSheet;
nsICSSImportRule* mParentRule; nsICSSImportRule* mParentRule;
@ -173,9 +172,11 @@ public:
PRUint32 mPendingChildren; PRUint32 mPendingChildren;
PRBool mIsInline; PRPackedBool mDidBlockParser;
PRBool mIsAgent;
PRBool mSyncLoad; PRPackedBool mIsInline;
PRPackedBool mIsAgent;
PRPackedBool mSyncLoad;
nsICSSLoaderObserver* mObserver; nsICSSLoaderObserver* mObserver;
}; };
@ -358,12 +359,12 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL,
mSheetIndex(aDocIndex), mSheetIndex(aDocIndex),
mOwningElement(aOwner), mOwningElement(aOwner),
mParserToUnblock(aParserToUnblock), mParserToUnblock(aParserToUnblock),
mDidBlockParser(PR_FALSE),
mParentSheet(nsnull), mParentSheet(nsnull),
mParentRule(nsnull), mParentRule(nsnull),
mNext(nsnull), mNext(nsnull),
mParentData(nsnull), mParentData(nsnull),
mPendingChildren(0), mPendingChildren(0),
mDidBlockParser(PR_FALSE),
mIsInline(aIsInline), mIsInline(aIsInline),
mIsAgent(PR_FALSE), mIsAgent(PR_FALSE),
mSyncLoad(PR_FALSE), mSyncLoad(PR_FALSE),

View File

@ -95,10 +95,10 @@ enum nsCSSTokenType {
struct nsCSSToken { struct nsCSSToken {
nsCSSTokenType mType; nsCSSTokenType mType;
PRPackedBool mIntegerValid;
nsAutoString mIdent; nsAutoString mIdent;
float mNumber; float mNumber;
PRInt32 mInteger; PRInt32 mInteger;
PRBool mIntegerValid;
PRUnichar mSymbol; PRUnichar mSymbol;
nsCSSToken(); nsCSSToken();

View File

@ -107,8 +107,8 @@ public:
} }
nscolor mBackgroundColor; nscolor mBackgroundColor;
PRBool mForegroundSet; PRPackedBool mForegroundSet;
PRBool mBackgroundSet; PRPackedBool mBackgroundSet;
}; };
HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet) HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet)

View File

@ -279,10 +279,10 @@ struct nsCachedStyleData
struct nsRuleData struct nsRuleData
{ {
nsStyleStructID mSID; nsStyleStructID mSID;
PRPackedBool mCanStoreInRuleTree;
nsIPresContext* mPresContext; nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext; nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback; nsPostResolveFunc mPostResolveCallback;
PRBool mCanStoreInRuleTree;
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures! nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData; nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData; nsCSSMargin* mMarginData;

View File

@ -163,7 +163,6 @@ public:
nsIContent* mOwningElement; nsIContent* mOwningElement;
nsIParser* mParserToUnblock; nsIParser* mParserToUnblock;
PRBool mDidBlockParser;
nsICSSStyleSheet* mParentSheet; nsICSSStyleSheet* mParentSheet;
nsICSSImportRule* mParentRule; nsICSSImportRule* mParentRule;
@ -173,9 +172,11 @@ public:
PRUint32 mPendingChildren; PRUint32 mPendingChildren;
PRBool mIsInline; PRPackedBool mDidBlockParser;
PRBool mIsAgent;
PRBool mSyncLoad; PRPackedBool mIsInline;
PRPackedBool mIsAgent;
PRPackedBool mSyncLoad;
nsICSSLoaderObserver* mObserver; nsICSSLoaderObserver* mObserver;
}; };
@ -358,12 +359,12 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL,
mSheetIndex(aDocIndex), mSheetIndex(aDocIndex),
mOwningElement(aOwner), mOwningElement(aOwner),
mParserToUnblock(aParserToUnblock), mParserToUnblock(aParserToUnblock),
mDidBlockParser(PR_FALSE),
mParentSheet(nsnull), mParentSheet(nsnull),
mParentRule(nsnull), mParentRule(nsnull),
mNext(nsnull), mNext(nsnull),
mParentData(nsnull), mParentData(nsnull),
mPendingChildren(0), mPendingChildren(0),
mDidBlockParser(PR_FALSE),
mIsInline(aIsInline), mIsInline(aIsInline),
mIsAgent(PR_FALSE), mIsAgent(PR_FALSE),
mSyncLoad(PR_FALSE), mSyncLoad(PR_FALSE),

View File

@ -95,10 +95,10 @@ enum nsCSSTokenType {
struct nsCSSToken { struct nsCSSToken {
nsCSSTokenType mType; nsCSSTokenType mType;
PRPackedBool mIntegerValid;
nsAutoString mIdent; nsAutoString mIdent;
float mNumber; float mNumber;
PRInt32 mInteger; PRInt32 mInteger;
PRBool mIntegerValid;
PRUnichar mSymbol; PRUnichar mSymbol;
nsCSSToken(); nsCSSToken();

View File

@ -107,8 +107,8 @@ public:
} }
nscolor mBackgroundColor; nscolor mBackgroundColor;
PRBool mForegroundSet; PRPackedBool mForegroundSet;
PRBool mBackgroundSet; PRPackedBool mBackgroundSet;
}; };
HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet) HTMLColorRule::HTMLColorRule(nsIHTMLStyleSheet* aSheet)

View File

@ -279,10 +279,10 @@ struct nsCachedStyleData
struct nsRuleData struct nsRuleData
{ {
nsStyleStructID mSID; nsStyleStructID mSID;
PRPackedBool mCanStoreInRuleTree;
nsIPresContext* mPresContext; nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext; nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback; nsPostResolveFunc mPostResolveCallback;
PRBool mCanStoreInRuleTree;
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures! nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData; nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData; nsCSSMargin* mMarginData;