From 21e537be09c6e3011411233ac7ccfd04e5c1df41 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 4 Apr 2003 22:37:52 +0000 Subject: [PATCH] No need for two separate document viewer constructors. Bug 158804, r=peterv, sr=jst --- content/base/src/nsDocumentViewer.cpp | 25 +++++++++---------------- layout/base/nsDocumentViewer.cpp | 25 +++++++++---------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 52598a9f7e0..fe54d2026bb 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -325,7 +325,6 @@ class DocumentViewerImpl : public nsIDocumentViewer, friend class nsPrintEngine; public: - DocumentViewerImpl(); DocumentViewerImpl(nsIPresContext* aPresContext); NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW @@ -421,9 +420,9 @@ protected: nsCOMPtr mPreviousViewer; - PRBool mEnableRendering; - PRBool mStopped; - PRBool mLoaded; + PRPackedBool mEnableRendering; + PRPackedBool mStopped; + PRPackedBool mLoaded; PRInt16 mNumURLStarts; PRInt16 mDestroyRefCount; // a second "refcount" for the document viewer's "destroy" @@ -472,7 +471,7 @@ static NS_DEFINE_CID(kViewCID, NS_VIEW_CID); nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult) { - *aResult = new DocumentViewerImpl(); + *aResult = new DocumentViewerImpl(nsnull); if (!*aResult) { return NS_ERROR_OUT_OF_MEMORY; } @@ -482,15 +481,6 @@ NS_NewDocumentViewer(nsIDocumentViewer** aResult) return NS_OK; } -// Note: operator new zeros our memory -DocumentViewerImpl::DocumentViewerImpl() - : mIsSticky(PR_TRUE) -{ - PrepareToStartLoad(); - - mParentWidget = nsnull; -} - void DocumentViewerImpl::PrepareToStartLoad() { mEnableRendering = PR_TRUE; @@ -519,10 +509,13 @@ void DocumentViewerImpl::PrepareToStartLoad() #endif // NS_PRINTING } +// Note: operator new zeros our memory, so no need to init things to null. DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext) - : mPresContext(aPresContext), mAllowPlugins(PR_TRUE), mIsSticky(PR_TRUE) + : mPresContext(aPresContext), + mAllowPlugins(PR_TRUE), + mIsSticky(PR_TRUE), + mHintCharsetSource(kCharsetUninitialized) { - mHintCharsetSource = kCharsetUninitialized; PrepareToStartLoad(); } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 52598a9f7e0..fe54d2026bb 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -325,7 +325,6 @@ class DocumentViewerImpl : public nsIDocumentViewer, friend class nsPrintEngine; public: - DocumentViewerImpl(); DocumentViewerImpl(nsIPresContext* aPresContext); NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW @@ -421,9 +420,9 @@ protected: nsCOMPtr mPreviousViewer; - PRBool mEnableRendering; - PRBool mStopped; - PRBool mLoaded; + PRPackedBool mEnableRendering; + PRPackedBool mStopped; + PRPackedBool mLoaded; PRInt16 mNumURLStarts; PRInt16 mDestroyRefCount; // a second "refcount" for the document viewer's "destroy" @@ -472,7 +471,7 @@ static NS_DEFINE_CID(kViewCID, NS_VIEW_CID); nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult) { - *aResult = new DocumentViewerImpl(); + *aResult = new DocumentViewerImpl(nsnull); if (!*aResult) { return NS_ERROR_OUT_OF_MEMORY; } @@ -482,15 +481,6 @@ NS_NewDocumentViewer(nsIDocumentViewer** aResult) return NS_OK; } -// Note: operator new zeros our memory -DocumentViewerImpl::DocumentViewerImpl() - : mIsSticky(PR_TRUE) -{ - PrepareToStartLoad(); - - mParentWidget = nsnull; -} - void DocumentViewerImpl::PrepareToStartLoad() { mEnableRendering = PR_TRUE; @@ -519,10 +509,13 @@ void DocumentViewerImpl::PrepareToStartLoad() #endif // NS_PRINTING } +// Note: operator new zeros our memory, so no need to init things to null. DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext) - : mPresContext(aPresContext), mAllowPlugins(PR_TRUE), mIsSticky(PR_TRUE) + : mPresContext(aPresContext), + mAllowPlugins(PR_TRUE), + mIsSticky(PR_TRUE), + mHintCharsetSource(kCharsetUninitialized) { - mHintCharsetSource = kCharsetUninitialized; PrepareToStartLoad(); }