Bug 92575: voidarray->autovoidarray changes in content/*, minus mChildren

changes in nsXULContentSink.cpp and nsGenericElement.cpp as per jst.
  r=hyatt r=pierre sr=jst
This commit is contained in:
rjesup%wgate.com 2001-09-06 19:16:03 +00:00
Родитель b358a062ff
Коммит be7d4d271c
20 изменённых файлов: 68 добавлений и 57 удалений

Просмотреть файл

@ -786,10 +786,11 @@ protected:
nsContentSubtreeIterator& operator=(const nsContentSubtreeIterator&);
nsCOMPtr<nsIDOMRange> mRange;
nsVoidArray mStartNodes;
nsVoidArray mStartOffsets;
nsVoidArray mEndNodes;
nsVoidArray mEndOffsets;
// these arrays all typically are used and have elements
nsAutoVoidArray mStartNodes;
nsAutoVoidArray mStartOffsets;
nsAutoVoidArray mEndNodes;
nsAutoVoidArray mEndOffsets;
};
nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aInstancePtrResult);

Просмотреть файл

@ -54,7 +54,7 @@ public:
NS_IMETHOD Reset();
protected:
nsVoidArray mElements;
nsAutoVoidArray mElements;
};

Просмотреть файл

@ -546,8 +546,8 @@ protected:
nsCOMPtr<nsISupportsArray> mChildren; // contains owning references
nsIContent* mRootContent; // a weak reference to the only element in
// mChildren, or null if no such element exists.
nsVoidArray mStyleSheets;
nsVoidArray mObservers;
nsAutoVoidArray mStyleSheets;
nsAutoVoidArray mObservers; // basically always has at least 1 entry
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
nsIEventListenerManager* mListenerManager;
PRBool mInDestructor;

Просмотреть файл

@ -142,11 +142,11 @@ protected:
PRInt32 mStartRootIndex;
PRInt32 mEndRootIndex;
PRBool mHaltRangeHint;
nsVoidArray mCommonAncestors;
nsVoidArray mStartNodes;
nsVoidArray mStartOffsets;
nsVoidArray mEndNodes;
nsVoidArray mEndOffsets;
nsAutoVoidArray mCommonAncestors;
nsAutoVoidArray mStartNodes;
nsAutoVoidArray mStartOffsets;
nsAutoVoidArray mEndNodes;
nsAutoVoidArray mEndOffsets;
};
#ifdef XP_MAC

Просмотреть файл

@ -702,7 +702,7 @@ nsGenericDOMDataNode::RangeAdd(nsIDOMRange& aRange)
{
// lazy allocation of range list
if (nsnull == mRangeList) {
mRangeList = new nsVoidArray();
mRangeList = new nsAutoVoidArray();
}
if (nsnull == mRangeList) {
return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -349,6 +349,7 @@ nsCheapVoidArray::SwitchToVector()
{
void* child = GetSingleChild();
// XXX Probably should be nsAutoVoidArray to avoid extra alloc - check bloat!
mChildren = (void*)new nsVoidArray();
nsVoidArray* vector = GetChildVector();
if (vector && child) {
@ -1896,7 +1897,7 @@ nsGenericElement::RangeAdd(nsIDOMRange& aRange)
// lazy allocation of range list
if (!mDOMSlots->mRangeList) {
mDOMSlots->mRangeList = new nsVoidArray();
mDOMSlots->mRangeList = new nsAutoVoidArray();
}
if (!mDOMSlots->mRangeList) {
return NS_ERROR_OUT_OF_MEMORY;
@ -3006,7 +3007,7 @@ nsGenericContainerElement::SetAttr(nsINodeInfo* aNodeInfo,
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
if (!mAttributes) {
mAttributes = new nsVoidArray();
mAttributes = new nsAutoVoidArray();
NS_ENSURE_TRUE(mAttributes, NS_ERROR_OUT_OF_MEMORY);
}

Просмотреть файл

@ -735,13 +735,13 @@ PRBool nsRange::IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOffset,
// lazy allocation of static arrays
if (!mStartAncestors)
{
mStartAncestors = new nsVoidArray();
mStartAncestors = new nsAutoVoidArray();
if (!mStartAncestors) return NS_ERROR_OUT_OF_MEMORY;
mStartAncestorOffsets = new nsVoidArray();
mStartAncestorOffsets = new nsAutoVoidArray();
if (!mStartAncestorOffsets) return NS_ERROR_OUT_OF_MEMORY;
mEndAncestors = new nsVoidArray();
mEndAncestors = new nsAutoVoidArray();
if (!mEndAncestors) return NS_ERROR_OUT_OF_MEMORY;
mEndAncestorOffsets = new nsVoidArray();
mEndAncestorOffsets = new nsAutoVoidArray();
if (!mEndAncestorOffsets) return NS_ERROR_OUT_OF_MEMORY;
}
@ -906,8 +906,8 @@ nsCOMPtr<nsIDOMNode> nsRange::CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode
// otherwise traverse the tree for the common ancestor
// For now, a pretty dumb hack on computing this
nsVoidArray array1;
nsVoidArray array2;
nsAutoVoidArray array1;
nsAutoVoidArray array2;
PRInt32 i=0, j=0;
// get ancestors of each node
@ -1404,7 +1404,7 @@ nsresult nsRange::DeleteContents()
*/
// get start node ancestors
nsVoidArray startAncestorList;
nsAutoVoidArray startAncestorList;
FillArrayWithAncestors(&startAncestorList,mStartParent);
@ -1419,7 +1419,7 @@ nsresult nsRange::DeleteContents()
// and then releasing them when we take them off
nsAutoRangeLock lock;
nsVoidArray deleteList;
nsAutoVoidArray deleteList;
nsCOMPtr<nsIContent> cN;
nsCOMPtr<nsIContent> cParent;
PRInt32 indx;

Просмотреть файл

@ -215,7 +215,7 @@ nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType,
}
NS_ASSERTION(!(mGenericListeners->Get(aKey)), "Found existing generic listeners, should be none");
nsVoidArray* listeners;
listeners = new nsVoidArray();
listeners = new nsAutoVoidArray();
if (!listeners) {
//out of memory
return nsnull;
@ -229,7 +229,7 @@ nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType,
//Change single type into multi, then add new listener with the code for the
//multi type below
NS_ASSERTION(!mMultiListeners, "Found existing multi listener array, should be none");
mMultiListeners = new nsVoidArray(EVENT_ARRAY_TYPE_LENGTH);
mMultiListeners = new nsAutoVoidArray();
if (!mMultiListeners) {
//out of memory
return nsnull;
@ -241,6 +241,7 @@ nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType,
mManagerType &= ~NS_ELM_SINGLE;
mManagerType |= NS_ELM_MULTI;
// we'll fall through into the multi case
}
if (mManagerType & NS_ELM_MULTI) {
@ -248,7 +249,7 @@ nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType,
if (index >= 0) {
nsVoidArray* listeners;
NS_ASSERTION(!mMultiListeners->ElementAt(index), "Found existing listeners, should be none");
listeners = new nsVoidArray();
listeners = new nsAutoVoidArray();
if (!listeners) {
//out of memory
return nsnull;
@ -261,7 +262,7 @@ nsVoidArray* nsEventListenerManager::GetListenersByType(EventArrayType aType,
//We had no pre-existing type. This is our first non-hash listener.
//Create the single listener type
NS_ASSERTION(!mSingleListener, "Found existing single listener array, should be none");
mSingleListener = new nsVoidArray();
mSingleListener = new nsAutoVoidArray();
if (!mSingleListener) {
//out of memory
return nsnull;
@ -430,7 +431,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
ls->mSubType = aSubType;
ls->mSubTypeCapture = NS_EVENT_BITS_NONE;
ls->mHandlerIsString = 0;
listeners->InsertElementAt((void*)ls, listeners->Count());
listeners->AppendElement((void*)ls);
NS_ADDREF(aListener);
}

Просмотреть файл

@ -150,7 +150,7 @@ public:
nsIDOMHTMLFormElement* mForm; // WEAK - the form owns me
nsVoidArray mElements; // Holds WEAK references - bug 36639
nsAutoVoidArray mElements; // Holds WEAK references - bug 36639
// This hash holds on to all form controls that are not named form
// control (see IsNamedFormControl()), this is needed to properly

Просмотреть файл

@ -376,7 +376,7 @@ nsHTMLLinkElement::GetStyleSheetInfo(nsAWritableString& aUrl,
GetAttribute(NS_LITERAL_STRING("rel"), rel);
rel.CompressWhitespace();
nsStringArray linkTypes;
nsStringArray linkTypes(4);
nsStyleLinkElement::ParseLinkTypes(rel, linkTypes);
// is it a stylesheet link?
if (linkTypes.IndexOf(NS_LITERAL_STRING("stylesheet")) < 0)

Просмотреть файл

@ -375,7 +375,7 @@ public:
nsIDOMHTMLFormElement* mCurrentForm;
nsIHTMLContent* mCurrentMap;
nsVoidArray mContextStack;
nsAutoVoidArray mContextStack;
SinkContext* mCurrentContext;
SinkContext* mHeadContext;
PRInt32 mNumOpenIFRAMES;

Просмотреть файл

@ -302,7 +302,8 @@ public:
nsHashtable mLoadedSheets; // url to first sheet fully loaded for URL
nsHashtable mLoadingSheets; // all current loads
nsVoidArray mParsingData; // array of data for sheets currently parsing
// mParsingData is (almost?) always needed, so create with storage
nsAutoVoidArray mParsingData; // array of data for sheets currently parsing
nsVoidArray mPendingDocSheets; // loaded sheet waiting for doc insertion
nsVoidArray mPendingAlternateSheets; // alternates waiting for load to start
@ -481,7 +482,7 @@ static PRBool PR_CALLBACK DeleteLoadData(void* aData, void* aClosure)
static PRBool PR_CALLBACK DeleteSheetMap(nsHashKey* aKey, void* aData, void* aClosure)
{
nsVoidArray* map = (nsVoidArray*)aData;
nsAutoVoidArray* map = (nsAutoVoidArray*)aData;
delete map;
return PR_TRUE;
}
@ -1101,9 +1102,9 @@ CSSLoaderImpl::InsertSheetInDoc(nsICSSStyleSheet* aSheet, PRInt32 aDocIndex,
aSheet->SetEnabled(! IsAlternate(title));
nsVoidKey key(mDocument);
nsVoidArray* sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key);
nsAutoVoidArray* sheetMap = (nsAutoVoidArray*)mSheetMapTable.Get(&key);
if (! sheetMap) {
sheetMap = new nsVoidArray();
sheetMap = new nsAutoVoidArray();
if (sheetMap) {
mSheetMapTable.Put(&key, sheetMap);
}
@ -1142,9 +1143,9 @@ CSSLoaderImpl::InsertChildSheet(nsICSSStyleSheet* aSheet, nsICSSStyleSheet* aPar
}
nsVoidKey key(aParentSheet);
nsVoidArray* sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key);
nsAutoVoidArray* sheetMap = (nsAutoVoidArray*)mSheetMapTable.Get(&key);
if (! sheetMap) {
sheetMap = new nsVoidArray();
sheetMap = new nsAutoVoidArray();
if (sheetMap) {
mSheetMapTable.Put(&key, sheetMap);
}

Просмотреть файл

@ -675,7 +675,7 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
nsVoidArray mSheets;
nsAutoVoidArray mSheets;
nsIURI* mURL;
@ -814,7 +814,7 @@ protected:
CSSStyleSheetInner* mInner;
nsVoidArray* mRuleProcessors;
nsAutoVoidArray* mRuleProcessors;
friend class CSSRuleProcessor;
friend class DOMMediaListImpl;
@ -1778,7 +1778,7 @@ CSSStyleSheetImpl::GetStyleRuleProcessor(nsIStyleRuleProcessor*& aProcessor,
if (NS_SUCCEEDED(result) && cssProcessor) {
cssProcessor->AppendStyleSheet(this);
if (! mRuleProcessors) {
mRuleProcessors = new nsVoidArray();
mRuleProcessors = new nsAutoVoidArray();
}
if (mRuleProcessors) {
NS_ASSERTION(-1 == mRuleProcessors->IndexOf(cssProcessor), "processor already registered");

Просмотреть файл

@ -222,7 +222,7 @@ private:
nsXBLService* mXBLService; // [WEAK]
nsCOMPtr<nsIStreamListener> mInner;
nsVoidArray mBindingRequests;
nsAutoVoidArray mBindingRequests;
nsCOMPtr<nsIWeakReference> mDocument;
nsCOMPtr<nsIDocument> mBindingDocument;

Просмотреть файл

@ -600,7 +600,7 @@ nsXMLContentSink::PushNameSpacesFrom(const nsIParserNode& aNode)
}
}
if (nsnull == mNameSpaceStack) {
mNameSpaceStack = new nsVoidArray();
mNameSpaceStack = new nsAutoVoidArray();
}
mNameSpaceStack->AppendElement(nameSpace);
}

Просмотреть файл

@ -46,7 +46,7 @@ class nsIDocument;
class nsIURI;
class nsIWebShell;
class nsIContent;
class nsVoidArray;
class nsAutoVoidArray;
class nsIXMLDocument;
class nsIUnicharInputStream;
class nsIParser;
@ -180,7 +180,7 @@ protected:
XMLContentSinkState mState;
nsCOMPtr<nsISupportsArray> mContentStack;
nsVoidArray* mNameSpaceStack;
nsAutoVoidArray* mNameSpaceStack;
PRUnichar* mText;
PRInt32 mTextLength;

Просмотреть файл

@ -176,7 +176,7 @@ protected:
void PopNameSpaces(void);
nsresult GetTopNameSpace(nsCOMPtr<nsINameSpace>* aNameSpace);
nsVoidArray mNameSpaceStack;
nsAutoVoidArray mNameSpaceStack;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
@ -214,6 +214,7 @@ protected:
protected:
struct Entry {
nsXULPrototypeNode* mNode;
// a LOT of nodes have children, but leave for now
nsVoidArray mChildren;
State mState;
Entry* mNext;

Просмотреть файл

@ -523,7 +523,8 @@ protected:
// NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE CHANGING
nsCOMPtr<nsIArena> mArena;
nsVoidArray mObservers;
// This always has at least one observer
nsAutoVoidArray mObservers;
nsString mDocumentTitle;
nsCOMPtr<nsIURI> mDocumentURL; // [OWNER] ??? compare with loader
nsCOMPtr<nsIURI> mDocumentBaseURL;
@ -535,11 +536,15 @@ protected:
nsIScriptGlobalObject* mScriptGlobalObject; // [WEAK]
nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
nsString mCharSetID;
nsVoidArray mCharSetObservers;
// This is set in nsPresContext::Init, which calls SetShell.
// Since I think this is almost always done, take the 32-byte hit for
// an nsAutoVoidArray instead of having it be a separate allocation.
nsAutoVoidArray mCharSetObservers;
nsVoidArray mStyleSheets;
nsCOMPtr<nsISelection> mSelection; // [OWNER]
PRInt8 mDisplaySelection;
nsVoidArray mPresShells;
// if we're attached to a DocumentViewImpl, we have a presshell
nsAutoVoidArray mPresShells;
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager; // [OWNER]
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet; // [OWNER]

Просмотреть файл

@ -302,7 +302,8 @@ public:
nsHashtable mLoadedSheets; // url to first sheet fully loaded for URL
nsHashtable mLoadingSheets; // all current loads
nsVoidArray mParsingData; // array of data for sheets currently parsing
// mParsingData is (almost?) always needed, so create with storage
nsAutoVoidArray mParsingData; // array of data for sheets currently parsing
nsVoidArray mPendingDocSheets; // loaded sheet waiting for doc insertion
nsVoidArray mPendingAlternateSheets; // alternates waiting for load to start
@ -481,7 +482,7 @@ static PRBool PR_CALLBACK DeleteLoadData(void* aData, void* aClosure)
static PRBool PR_CALLBACK DeleteSheetMap(nsHashKey* aKey, void* aData, void* aClosure)
{
nsVoidArray* map = (nsVoidArray*)aData;
nsAutoVoidArray* map = (nsAutoVoidArray*)aData;
delete map;
return PR_TRUE;
}
@ -1101,9 +1102,9 @@ CSSLoaderImpl::InsertSheetInDoc(nsICSSStyleSheet* aSheet, PRInt32 aDocIndex,
aSheet->SetEnabled(! IsAlternate(title));
nsVoidKey key(mDocument);
nsVoidArray* sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key);
nsAutoVoidArray* sheetMap = (nsAutoVoidArray*)mSheetMapTable.Get(&key);
if (! sheetMap) {
sheetMap = new nsVoidArray();
sheetMap = new nsAutoVoidArray();
if (sheetMap) {
mSheetMapTable.Put(&key, sheetMap);
}
@ -1142,9 +1143,9 @@ CSSLoaderImpl::InsertChildSheet(nsICSSStyleSheet* aSheet, nsICSSStyleSheet* aPar
}
nsVoidKey key(aParentSheet);
nsVoidArray* sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key);
nsAutoVoidArray* sheetMap = (nsAutoVoidArray*)mSheetMapTable.Get(&key);
if (! sheetMap) {
sheetMap = new nsVoidArray();
sheetMap = new nsAutoVoidArray();
if (sheetMap) {
mSheetMapTable.Put(&key, sheetMap);
}

Просмотреть файл

@ -675,7 +675,7 @@ public:
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
nsVoidArray mSheets;
nsAutoVoidArray mSheets;
nsIURI* mURL;
@ -814,7 +814,7 @@ protected:
CSSStyleSheetInner* mInner;
nsVoidArray* mRuleProcessors;
nsAutoVoidArray* mRuleProcessors;
friend class CSSRuleProcessor;
friend class DOMMediaListImpl;
@ -1778,7 +1778,7 @@ CSSStyleSheetImpl::GetStyleRuleProcessor(nsIStyleRuleProcessor*& aProcessor,
if (NS_SUCCEEDED(result) && cssProcessor) {
cssProcessor->AppendStyleSheet(this);
if (! mRuleProcessors) {
mRuleProcessors = new nsVoidArray();
mRuleProcessors = new nsAutoVoidArray();
}
if (mRuleProcessors) {
NS_ASSERTION(-1 == mRuleProcessors->IndexOf(cssProcessor), "processor already registered");