Bug 1186794 (part 4) - Replace nsBaseHashtable::EnumerateRead() calls in embedding/ with iterators. r=bz.

This commit is contained in:
Nicholas Nethercote 2015-11-01 18:42:28 -08:00
parent 7635e073c3
commit 9855915738
2 changed files with 18 additions and 32 deletions

View File

@ -1806,23 +1806,35 @@ nsWebBrowserPersist::FinishSaveDocumentInternal(nsIURI* aFile,
void nsWebBrowserPersist::Cleanup()
{
mURIMap.Clear();
mOutputMap.EnumerateRead(EnumCleanupOutputMap, this);
for (auto iter = mOutputMap.Iter(); !iter.Done(); iter.Next()) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(iter.Key());
if (channel) {
channel->Cancel(NS_BINDING_ABORTED);
}
}
mOutputMap.Clear();
mUploadList.EnumerateRead(EnumCleanupUploadList, this);
for (auto iter = mUploadList.Iter(); !iter.Done(); iter.Next()) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(iter.Key());
if (channel) {
channel->Cancel(NS_BINDING_ABORTED);
}
}
mUploadList.Clear();
uint32_t i;
for (i = 0; i < mDocList.Length(); i++)
{
for (i = 0; i < mDocList.Length(); i++) {
DocData *docData = mDocList.ElementAt(i);
delete docData;
}
mDocList.Clear();
for (i = 0; i < mCleanupList.Length(); i++)
{
for (i = 0; i < mCleanupList.Length(); i++) {
CleanupData *cleanupData = mCleanupList.ElementAt(i);
delete cleanupData;
}
mCleanupList.Clear();
mFilenameList.Clear();
}
@ -2487,28 +2499,6 @@ nsWebBrowserPersist::EnumCalcUploadProgress(nsISupports *aKey, UploadData *aData
return PL_DHASH_NEXT;
}
PLDHashOperator
nsWebBrowserPersist::EnumCleanupOutputMap(nsISupports *aKey, OutputData *aData, void* aClosure)
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aKey);
if (channel)
{
channel->Cancel(NS_BINDING_ABORTED);
}
return PL_DHASH_NEXT;
}
PLDHashOperator
nsWebBrowserPersist::EnumCleanupUploadList(nsISupports *aKey, UploadData *aData, void* aClosure)
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aKey);
if (channel)
{
channel->Cancel(NS_BINDING_ABORTED);
}
return PL_DHASH_NEXT;
}
nsresult
nsWebBrowserPersist::StoreURI(
const char *aURI, bool aNeedsPersisting, URIData **aData)

View File

@ -137,10 +137,6 @@ private:
void SetApplyConversionIfNeeded(nsIChannel *aChannel);
// Hash table enumerators
static PLDHashOperator EnumCleanupOutputMap(
nsISupports *aKey, OutputData *aData, void* aClosure);
static PLDHashOperator EnumCleanupUploadList(
nsISupports *aKey, UploadData *aData, void* aClosure);
static PLDHashOperator EnumCalcProgress(
nsISupports *aKey, OutputData *aData, void* aClosure);
static PLDHashOperator EnumCalcUploadProgress(