mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 08:48:07 +00:00
Bug 474369 - get rid of nsVoidArray; embedding part; r+sr=benjamin
This commit is contained in:
parent
b4004d5d81
commit
cd04d4b8dd
@ -70,7 +70,6 @@
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -152,7 +152,7 @@ GUID CGID_MSHTML_Moz =
|
||||
// CMozillaBrowser
|
||||
|
||||
|
||||
nsVoidArray CMozillaBrowser::sBrowserList;
|
||||
nsTArray<CMozillaBrowser*> CMozillaBrowser::sBrowserList;
|
||||
|
||||
//
|
||||
// Constructor
|
||||
|
@ -362,7 +362,7 @@ END_OLECOMMAND_TABLE()
|
||||
protected:
|
||||
|
||||
// List of browsers
|
||||
static nsVoidArray sBrowserList;
|
||||
static nsTArray<CMozillaBrowser*> sBrowserList;
|
||||
|
||||
// Name of profile to use
|
||||
nsString mProfileName;
|
||||
|
@ -100,7 +100,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -89,15 +89,15 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#endif
|
||||
|
||||
PRUint32 EmbedPrivate::sWidgetCount = 0;
|
||||
PRUint32 EmbedPrivate::sWidgetCount = 0;
|
||||
|
||||
char *EmbedPrivate::sPath = nsnull;
|
||||
char *EmbedPrivate::sCompPath = nsnull;
|
||||
nsVoidArray *EmbedPrivate::sWindowList = nsnull;
|
||||
nsILocalFile *EmbedPrivate::sProfileDir = nsnull;
|
||||
nsISupports *EmbedPrivate::sProfileLock = nsnull;
|
||||
GtkWidget *EmbedPrivate::sOffscreenWindow = 0;
|
||||
GtkWidget *EmbedPrivate::sOffscreenFixed = 0;
|
||||
char *EmbedPrivate::sPath = nsnull;
|
||||
char *EmbedPrivate::sCompPath = nsnull;
|
||||
nsTArray<EmbedPrivate*> *EmbedPrivate::sWindowList = nsnull;
|
||||
nsILocalFile *EmbedPrivate::sProfileDir = nsnull;
|
||||
nsISupports *EmbedPrivate::sProfileLock = nsnull;
|
||||
GtkWidget *EmbedPrivate::sOffscreenWindow = 0;
|
||||
GtkWidget *EmbedPrivate::sOffscreenFixed = 0;
|
||||
|
||||
nsIDirectoryServiceProvider *EmbedPrivate::sAppFileLocProvider = nsnull;
|
||||
|
||||
@ -193,7 +193,7 @@ EmbedPrivate::EmbedPrivate(void)
|
||||
|
||||
PushStartup();
|
||||
if (!sWindowList) {
|
||||
sWindowList = new nsVoidArray();
|
||||
sWindowList = new nsTArray<EmbedPrivate*>();
|
||||
}
|
||||
sWindowList->AppendElement(this);
|
||||
}
|
||||
@ -711,13 +711,12 @@ EmbedPrivate::FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser)
|
||||
return nsnull;
|
||||
|
||||
// Get the number of browser windows.
|
||||
PRInt32 count = sWindowList->Count();
|
||||
PRInt32 count = sWindowList->Length();
|
||||
// This function doesn't get called very often at all ( only when
|
||||
// creating a new window ) so it's OK to walk the list of open
|
||||
// windows.
|
||||
for (int i = 0; i < count; i++) {
|
||||
EmbedPrivate *tmpPrivate = static_cast<EmbedPrivate *>(
|
||||
sWindowList->ElementAt(i));
|
||||
EmbedPrivate *tmpPrivate = sWindowList->ElementAt(i);
|
||||
// get the browser object for that window
|
||||
nsIWebBrowserChrome *chrome = static_cast<nsIWebBrowserChrome *>(
|
||||
tmpPrivate->mWindow);
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsPIDOMEventTarget.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
// app component registration
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
@ -153,7 +153,7 @@ class EmbedPrivate {
|
||||
// the appshell we have created
|
||||
static nsIAppShell *sAppShell;
|
||||
// the list of all open windows
|
||||
static nsVoidArray *sWindowList;
|
||||
static nsTArray<EmbedPrivate*> *sWindowList;
|
||||
// what is our profile path?
|
||||
static nsILocalFile *sProfileDir;
|
||||
static nsISupports *sProfileLock;
|
||||
|
@ -101,10 +101,10 @@ extern char *g_Print_Left_Header_String, *g_Print_Right_Header_String, *g_Print_
|
||||
static const char sWatcherContractID[] = "@mozilla.org/embedcomp/window-watcher;1";
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
|
||||
nsIAppShell *EmbedPrivate::sAppShell = nsnull;
|
||||
nsIPref *EmbedPrivate::sPrefs = nsnull;
|
||||
nsVoidArray *EmbedPrivate::sWindowList = nsnull;
|
||||
nsClipboard *EmbedPrivate::sClipboard = nsnull;
|
||||
nsIAppShell *EmbedPrivate::sAppShell = nsnull;
|
||||
nsIPref *EmbedPrivate::sPrefs = nsnull;
|
||||
nsTArray<EmbedPrivate*> *EmbedPrivate::sWindowList = nsnull;
|
||||
nsClipboard *EmbedPrivate::sClipboard = nsnull;
|
||||
|
||||
EmbedPrivate::EmbedPrivate(void)
|
||||
{
|
||||
@ -121,7 +121,7 @@ EmbedPrivate::EmbedPrivate(void)
|
||||
mMozWindowWidget = 0;
|
||||
|
||||
if (!sWindowList) {
|
||||
sWindowList = new nsVoidArray();
|
||||
sWindowList = new nsTArray<EmbedPrivate*>();
|
||||
}
|
||||
sWindowList->AppendElement(this);
|
||||
if( !sClipboard ) {
|
||||
@ -708,14 +708,13 @@ EmbedPrivate::FindPrivateForBrowser(nsIWebBrowserChrome *aBrowser)
|
||||
return nsnull;
|
||||
|
||||
// Get the number of browser windows.
|
||||
PRInt32 count = sWindowList->Count();
|
||||
PRInt32 count = sWindowList->Length();
|
||||
// This function doesn't get called very often at all ( only when
|
||||
// creating a new window ) so it's OK to walk the list of open
|
||||
// windows.
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
EmbedPrivate *tmpPrivate = static_cast<EmbedPrivate *>
|
||||
(sWindowList->ElementAt(i));
|
||||
EmbedPrivate *tmpPrivate = sWindowList->ElementAt(i);
|
||||
// get the browser object for that window
|
||||
nsIWebBrowserChrome *chrome = static_cast<nsIWebBrowserChrome *>
|
||||
(tmpPrivate->mWindow);
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <nsIPrintSettings.h>
|
||||
#include <nsIAppShell.h>
|
||||
#include <nsPIDOMEventTarget.h>
|
||||
#include <nsVoidArray.h>
|
||||
#include <nsTArray.h>
|
||||
#include <nsClipboard.h>
|
||||
// for profiles
|
||||
#include <nsIPref.h>
|
||||
@ -177,7 +177,7 @@ class EmbedPrivate {
|
||||
static nsIAppShell *sAppShell;
|
||||
// for profiles
|
||||
static nsIPref *sPrefs;
|
||||
static nsVoidArray *sWindowList;
|
||||
static nsTArray<EmbedPrivate*> *sWindowList;
|
||||
// for clipboard input group setting
|
||||
static nsClipboard *sClipboard;
|
||||
|
||||
|
@ -123,12 +123,6 @@ nsWebBrowser::~nsWebBrowser()
|
||||
InternalDestroy();
|
||||
}
|
||||
|
||||
PRBool deleteListener(void *aElement, void *aData) {
|
||||
nsWebBrowserListenerState *state = (nsWebBrowserListenerState*)aElement;
|
||||
NS_DELETEXPCOM(state);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::InternalDestroy()
|
||||
{
|
||||
|
||||
@ -152,7 +146,10 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
|
||||
}
|
||||
|
||||
if (mListenerArray) {
|
||||
(void)mListenerArray->EnumerateForwards(deleteListener, nsnull);
|
||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||
NS_DELETEXPCOM(state);
|
||||
}
|
||||
delete mListenerArray;
|
||||
mListenerArray = nsnull;
|
||||
}
|
||||
@ -242,7 +239,7 @@ NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, c
|
||||
state->mID = aIID;
|
||||
|
||||
if (!mListenerArray) {
|
||||
NS_NEWXPCOM(mListenerArray, nsVoidArray);
|
||||
NS_NEWXPCOM(mListenerArray, nsTArray<nsWebBrowserListenerState*>);
|
||||
if (!mListenerArray) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -295,9 +292,9 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
|
||||
if (!mListenerArray) return NS_ERROR_FAILURE;
|
||||
|
||||
// iterate the array and remove the queued listener
|
||||
PRInt32 count = mListenerArray->Count();
|
||||
PRInt32 count = mListenerArray->Length();
|
||||
while (count > 0) {
|
||||
nsWebBrowserListenerState *state = (nsWebBrowserListenerState*)mListenerArray->ElementAt(count);
|
||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(count);
|
||||
NS_ASSERTION(state, "list construction problem");
|
||||
|
||||
if (state->Equals(aListener, aIID)) {
|
||||
@ -309,8 +306,11 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
|
||||
}
|
||||
|
||||
// if we've emptied the array, get rid of it.
|
||||
if (0 >= mListenerArray->Count()) {
|
||||
(void)mListenerArray->EnumerateForwards(deleteListener, nsnull);
|
||||
if (0 >= mListenerArray->Length()) {
|
||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||
NS_DELETEXPCOM(state);
|
||||
}
|
||||
NS_DELETEXPCOM(mListenerArray);
|
||||
mListenerArray = nsnull;
|
||||
}
|
||||
@ -1148,18 +1148,21 @@ NS_IMETHODIMP nsWebBrowser::Create()
|
||||
// the docshell has been set so we now have our listener registrars.
|
||||
if (mListenerArray) {
|
||||
// we had queued up some listeners, let's register them now.
|
||||
PRInt32 count = mListenerArray->Count();
|
||||
PRInt32 i = 0;
|
||||
PRUint32 count = mListenerArray->Length();
|
||||
PRUint32 i = 0;
|
||||
NS_ASSERTION(count > 0, "array construction problem");
|
||||
while (i < count) {
|
||||
nsWebBrowserListenerState *state = (nsWebBrowserListenerState*)mListenerArray->ElementAt(i);
|
||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||
NS_ASSERTION(state, "array construction problem");
|
||||
nsCOMPtr<nsISupports> listener = do_QueryReferent(state->mWeakPtr);
|
||||
NS_ASSERTION(listener, "bad listener");
|
||||
(void)BindListener(listener, state->mID);
|
||||
i++;
|
||||
}
|
||||
(void)mListenerArray->EnumerateForwards(deleteListener, nsnull);
|
||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||
NS_DELETEXPCOM(state);
|
||||
}
|
||||
NS_DELETEXPCOM(mListenerArray);
|
||||
mListenerArray = nsnull;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@
|
||||
#include "nsIPrintSettings.h"
|
||||
#include "nsEmbedStream.h"
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
|
||||
class nsIContentViewerFile;
|
||||
@ -188,8 +188,8 @@ protected:
|
||||
nsCOMPtr<nsISupports> mStreamGuard;
|
||||
|
||||
//Weak Reference interfaces...
|
||||
nsIWidget* mParentWidget;
|
||||
nsVoidArray * mListenerArray;
|
||||
nsIWidget* mParentWidget;
|
||||
nsTArray<nsWebBrowserListenerState*>* mListenerArray;
|
||||
};
|
||||
|
||||
#endif /* nsWebBrowser_h__ */
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsSupportsPrimitives.h"
|
||||
@ -168,7 +168,7 @@ nsGroupsEnumerator::Initialize()
|
||||
class nsNamedGroupEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
nsNamedGroupEnumerator(nsVoidArray* inArray);
|
||||
nsNamedGroupEnumerator(nsTArray<char*>* inArray);
|
||||
virtual ~nsNamedGroupEnumerator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -176,12 +176,12 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
nsVoidArray* mGroupArray;
|
||||
PRInt32 mIndex;
|
||||
nsTArray<char*>* mGroupArray;
|
||||
PRInt32 mIndex;
|
||||
|
||||
};
|
||||
|
||||
nsNamedGroupEnumerator::nsNamedGroupEnumerator(nsVoidArray* inArray)
|
||||
nsNamedGroupEnumerator::nsNamedGroupEnumerator(nsTArray<char*>* inArray)
|
||||
: mGroupArray(inArray)
|
||||
, mIndex(-1)
|
||||
{
|
||||
@ -199,7 +199,7 @@ nsNamedGroupEnumerator::HasMoreElements(PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
PRInt32 arrayLen = mGroupArray ? mGroupArray->Count() : 0;
|
||||
PRInt32 arrayLen = mGroupArray ? mGroupArray->Length() : 0;
|
||||
*_retval = (mIndex < arrayLen - 1);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -214,10 +214,10 @@ nsNamedGroupEnumerator::GetNext(nsISupports **_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mIndex ++;
|
||||
if (mIndex >= mGroupArray->Count())
|
||||
if (mIndex >= PRInt32(mGroupArray->Length()))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUnichar *thisGroupName = (PRUnichar *)mGroupArray->ElementAt(mIndex);
|
||||
PRUnichar *thisGroupName = (PRUnichar*)mGroupArray->ElementAt(mIndex);
|
||||
NS_ASSERTION(thisGroupName, "Bad Element in mGroupArray");
|
||||
|
||||
nsresult rv;
|
||||
@ -260,18 +260,18 @@ NS_IMETHODIMP
|
||||
nsControllerCommandGroup::AddCommandToGroup(const char * aCommand, const char *aGroup)
|
||||
{
|
||||
nsCStringKey groupKey(aGroup);
|
||||
nsVoidArray* commandList;
|
||||
if ((commandList = (nsVoidArray *)mGroupsHash.Get(&groupKey)) == nsnull)
|
||||
nsTArray<char*>* commandList;
|
||||
if ((commandList = (nsTArray<char*> *)mGroupsHash.Get(&groupKey)) == nsnull)
|
||||
{
|
||||
// make this list
|
||||
commandList = new nsAutoVoidArray;
|
||||
commandList = new nsAutoTArray<char*, 8>;
|
||||
mGroupsHash.Put(&groupKey, (void *)commandList);
|
||||
}
|
||||
// add the command to the list. Note that we're not checking for duplicates here
|
||||
char* commandString = nsCRT::strdup(aCommand); // we store allocated PRUnichar* in the array
|
||||
if (!commandString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool appended = commandList->AppendElement((void *)commandString);
|
||||
PRBool appended = commandList->AppendElement(commandString) != nsnull;
|
||||
NS_ASSERTION(appended, "Append failed");
|
||||
|
||||
return NS_OK;
|
||||
@ -282,13 +282,13 @@ NS_IMETHODIMP
|
||||
nsControllerCommandGroup::RemoveCommandFromGroup(const char * aCommand, const char * aGroup)
|
||||
{
|
||||
nsCStringKey groupKey(aGroup);
|
||||
nsVoidArray* commandList = (nsVoidArray *)mGroupsHash.Get(&groupKey);
|
||||
nsTArray<char*>* commandList = (nsTArray<char*> *)mGroupsHash.Get(&groupKey);
|
||||
if (!commandList) return NS_OK; // no group
|
||||
|
||||
PRInt32 numEntries = commandList->Count();
|
||||
for (PRInt32 i = 0; i < numEntries; i ++)
|
||||
PRUint32 numEntries = commandList->Length();
|
||||
for (PRUint32 i = 0; i < numEntries; i ++)
|
||||
{
|
||||
char* commandString = (char*)commandList->ElementAt(i);
|
||||
char* commandString = commandList->ElementAt(i);
|
||||
if (!nsCRT::strcmp(aCommand,commandString))
|
||||
{
|
||||
commandList->RemoveElementAt(i);
|
||||
@ -308,13 +308,13 @@ nsControllerCommandGroup::IsCommandInGroup(const char * aCommand, const char * a
|
||||
*_retval = PR_FALSE;
|
||||
|
||||
nsCStringKey groupKey(aGroup);
|
||||
nsVoidArray* commandList = (nsVoidArray *)mGroupsHash.Get(&groupKey);
|
||||
nsTArray<char*>* commandList = (nsTArray<char*> *)mGroupsHash.Get(&groupKey);
|
||||
if (!commandList) return NS_OK; // no group
|
||||
|
||||
PRInt32 numEntries = commandList->Count();
|
||||
for (PRInt32 i = 0; i < numEntries; i ++)
|
||||
PRUint32 numEntries = commandList->Length();
|
||||
for (PRUint32 i = 0; i < numEntries; i ++)
|
||||
{
|
||||
char* commandString = (char*)commandList->ElementAt(i);
|
||||
char* commandString = commandList->ElementAt(i);
|
||||
if (!nsCRT::strcmp(aCommand,commandString))
|
||||
{
|
||||
*_retval = PR_TRUE;
|
||||
@ -339,7 +339,7 @@ NS_IMETHODIMP
|
||||
nsControllerCommandGroup::GetEnumeratorForGroup(const char * aGroup, nsISimpleEnumerator **_retval)
|
||||
{
|
||||
nsCStringKey groupKey(aGroup);
|
||||
nsVoidArray* commandList = (nsVoidArray *)mGroupsHash.Get(&groupKey); // may be null
|
||||
nsTArray<char*>* commandList = (nsTArray<char*> *)mGroupsHash.Get(&groupKey); // may be null
|
||||
|
||||
nsNamedGroupEnumerator* theGroupEnum = new nsNamedGroupEnumerator(commandList);
|
||||
if (!theGroupEnum) return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -353,13 +353,13 @@ nsControllerCommandGroup::GetEnumeratorForGroup(const char * aGroup, nsISimpleEn
|
||||
|
||||
PRBool nsControllerCommandGroup::ClearEnumerator(nsHashKey *aKey, void *aData, void* closure)
|
||||
{
|
||||
nsVoidArray* commandList = (nsVoidArray *)aData;
|
||||
nsTArray<char*>* commandList = (nsTArray<char*> *)aData;
|
||||
if (commandList)
|
||||
{
|
||||
PRInt32 numEntries = commandList->Count();
|
||||
for (PRInt32 i = 0; i < numEntries; i ++)
|
||||
PRUint32 numEntries = commandList->Length();
|
||||
for (PRUint32 i = 0; i < numEntries; i ++)
|
||||
{
|
||||
char* commandString = (char*)commandList->ElementAt(i);
|
||||
char* commandString = commandList->ElementAt(i);
|
||||
nsMemory::Free(commandString);
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ nsWebBrowserPersist::SerializeNextFile()
|
||||
|
||||
return (mURIMap.Count()
|
||||
|| mUploadList.Count()
|
||||
|| mDocList.Count()
|
||||
|| mDocList.Length()
|
||||
|| mOutputMap.Count());
|
||||
}
|
||||
|
||||
@ -775,7 +775,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(
|
||||
{
|
||||
// if no documents left in mDocList, --> done
|
||||
// if we have no files left to serialize and no error result, --> done
|
||||
if (mDocList.Count() == 0
|
||||
if (mDocList.Length() == 0
|
||||
|| (!SerializeNextFile() && NS_SUCCEEDED(mPersistResult)))
|
||||
{
|
||||
completed = PR_TRUE;
|
||||
@ -1725,10 +1725,10 @@ nsresult nsWebBrowserPersist::SaveDocuments()
|
||||
// Iterate through all queued documents, saving them to file and fixing
|
||||
// them up on the way.
|
||||
|
||||
PRInt32 i;
|
||||
for (i = 0; i < mDocList.Count(); i++)
|
||||
PRUint32 i;
|
||||
for (i = 0; i < mDocList.Length(); i++)
|
||||
{
|
||||
DocData *docData = (DocData *) mDocList.ElementAt(i);
|
||||
DocData *docData = mDocList.ElementAt(i);
|
||||
if (!docData)
|
||||
{
|
||||
rv = NS_ERROR_FAILURE;
|
||||
@ -1773,9 +1773,9 @@ nsresult nsWebBrowserPersist::SaveDocuments()
|
||||
}
|
||||
|
||||
// delete, cleanup regardless of errors (bug 132417)
|
||||
for (i = 0; i < mDocList.Count(); i++)
|
||||
for (i = 0; i < mDocList.Length(); i++)
|
||||
{
|
||||
DocData *docData = (DocData *) mDocList.ElementAt(i);
|
||||
DocData *docData = mDocList.ElementAt(i);
|
||||
delete docData;
|
||||
if (mSerializingOutput)
|
||||
{
|
||||
@ -1800,16 +1800,16 @@ void nsWebBrowserPersist::Cleanup()
|
||||
mOutputMap.Reset();
|
||||
mUploadList.Enumerate(EnumCleanupUploadList, this);
|
||||
mUploadList.Reset();
|
||||
PRInt32 i;
|
||||
for (i = 0; i < mDocList.Count(); i++)
|
||||
PRUint32 i;
|
||||
for (i = 0; i < mDocList.Length(); i++)
|
||||
{
|
||||
DocData *docData = (DocData *) mDocList.ElementAt(i);
|
||||
DocData *docData = mDocList.ElementAt(i);
|
||||
delete docData;
|
||||
}
|
||||
mDocList.Clear();
|
||||
for (i = 0; i < mCleanupList.Count(); i++)
|
||||
for (i = 0; i < mCleanupList.Length(); i++)
|
||||
{
|
||||
CleanupData *cleanupData = (CleanupData *) mCleanupList.ElementAt(i);
|
||||
CleanupData *cleanupData = mCleanupList.ElementAt(i);
|
||||
delete cleanupData;
|
||||
}
|
||||
mCleanupList.Clear();
|
||||
@ -1825,10 +1825,10 @@ void nsWebBrowserPersist::CleanupLocalFiles()
|
||||
int pass;
|
||||
for (pass = 0; pass < 2; pass++)
|
||||
{
|
||||
PRInt32 i;
|
||||
for (i = 0; i < mCleanupList.Count(); i++)
|
||||
PRUint32 i;
|
||||
for (i = 0; i < mCleanupList.Length(); i++)
|
||||
{
|
||||
CleanupData *cleanupData = (CleanupData *) mCleanupList.ElementAt(i);
|
||||
CleanupData *cleanupData = mCleanupList.ElementAt(i);
|
||||
nsCOMPtr<nsILocalFile> file = cleanupData->mFile;
|
||||
|
||||
// Test if the dir / file exists (something in an earlier loop
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include "nsIWebProgressListener2.h"
|
||||
|
||||
#include "nsHashtable.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsInt64.h"
|
||||
|
||||
@ -67,6 +66,8 @@ class nsEncoderNodeFixup;
|
||||
class nsIStorageStream;
|
||||
|
||||
struct URIData;
|
||||
struct CleanupData;
|
||||
struct DocData;
|
||||
|
||||
class nsWebBrowserPersist : public nsIInterfaceRequestor,
|
||||
public nsIWebBrowserPersist,
|
||||
@ -225,8 +226,8 @@ private:
|
||||
nsHashtable mOutputMap;
|
||||
nsHashtable mUploadList;
|
||||
nsHashtable mURIMap;
|
||||
nsVoidArray mDocList;
|
||||
nsVoidArray mCleanupList;
|
||||
nsTArray<DocData*> mDocList;
|
||||
nsTArray<CleanupData*> mCleanupList;
|
||||
nsTArray<nsCString> mFilenameList;
|
||||
PRPackedBool mFirstAndOnlyUse;
|
||||
PRPackedBool mCancel;
|
||||
|
@ -1247,15 +1247,15 @@ nsWindowWatcher::FindWindowEntry(nsIDOMWindow *aWindow)
|
||||
|
||||
nsresult nsWindowWatcher::RemoveWindow(nsWatcherWindowEntry *inInfo)
|
||||
{
|
||||
PRInt32 ctr,
|
||||
count = mEnumeratorList.Count();
|
||||
PRUint32 ctr,
|
||||
count = mEnumeratorList.Length();
|
||||
nsresult rv;
|
||||
|
||||
{
|
||||
// notify the enumerators
|
||||
nsAutoLock lock(mListLock);
|
||||
for (ctr = 0; ctr < count; ++ctr)
|
||||
((nsWatcherWindowEnumerator*)mEnumeratorList[ctr])->WindowRemoved(inInfo);
|
||||
mEnumeratorList[ctr]->WindowRemoved(inInfo);
|
||||
|
||||
// remove the element from the list
|
||||
if (inInfo == mOldestWindow)
|
||||
@ -1342,7 +1342,7 @@ PRBool
|
||||
nsWindowWatcher::AddEnumerator(nsWatcherWindowEnumerator* inEnumerator)
|
||||
{
|
||||
// (requires a lock; assumes it's called by someone holding the lock)
|
||||
return mEnumeratorList.AppendElement(inEnumerator);
|
||||
return mEnumeratorList.AppendElement(inEnumerator) != nsnull;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "nsIPromptFactory.h"
|
||||
#include "nsIAuthPromptAdapterFactory.h"
|
||||
#include "nsPIWindowWatcher.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsIDocShellTreeItem;
|
||||
@ -144,7 +144,7 @@ private:
|
||||
static void GetWindowTreeOwner(nsIDOMWindow *inWindow,
|
||||
nsIDocShellTreeOwner **outTreeOwner);
|
||||
|
||||
nsVoidArray mEnumeratorList;
|
||||
nsTArray<nsWatcherWindowEnumerator*> mEnumeratorList;
|
||||
nsWatcherWindowEntry *mOldestWindow;
|
||||
nsIDOMWindow *mActiveWindow;
|
||||
PRLock *mListLock;
|
||||
|
@ -61,7 +61,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsCWebBrowser.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user