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 mColPos;
PRBool mInBody;
PRUint32 mFlags;
PRPackedBool mInBody;
PRBool mDoFormat;
PRBool mDoHeader;
PRBool mBodyOnly;
PRInt32 mPreLevel;
PRPackedBool mDoFormat;
PRPackedBool mDoHeader;
PRPackedBool mBodyOnly;
PRInt32 mPreLevel;
/*
* 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
* what so ever.
*/
PRBool mInCDATA;
PRPackedBool mInCDATA;
PRPackedBool mIsLatin1;
PRInt32 mMaxColumn;
nsString mLineBreak;
PRBool mIsLatin1;
nsCOMPtr<nsIAtom> mCharSet;
};

View File

@ -195,11 +195,14 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
if(mFlags & nsIDocumentEncoder::OutputFormatted) {
PRBool tempBool;
// 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);
// 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.

View File

@ -164,13 +164,16 @@ protected:
protected:
nsString mCurrentLine;
PRBool mInHead;
PRPackedBool mInHead;
PRPackedBool mAtFirstColumn;
PRPackedBool mQuotesPreformatted; // (pref)
PRPackedBool mStructs; // Output structs (pref)
PRInt32 mIndent;
// mInIndentString keeps a header that has to be written in the indent.
// That could be, for instance, the bullet in a bulleted list.
nsString mInIndentString;
PRInt32 mCiteQuoteLevel;
PRBool mAtFirstColumn;
PRInt32 mFlags;
// 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.
// Having it on a pref is a temporary measure, See bug 69638.
PRInt32 mSpanLevel;
PRBool mQuotesPreformatted;
PRBool mDoFragment;
PRInt32 mEmptyLines; // Will be the number of empty lines before
// the current. 0 if we are starting a new
// line and -1 if we are in a line.
PRBool mInWhitespace;
PRBool mPreFormatted;
PRBool mStartedOutput; // we've produced at least a character
PRPackedBool mInWhitespace;
PRPackedBool mPreFormatted;
PRPackedBool mStartedOutput; // we've produced at least a character
nsString mURL;
PRBool mStructs; // Output structs (pref)
PRInt32 mHeaderStrategy; /* Header strategy (pref)
0 = no indention
1 = indention, increased with

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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