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

--HG--
extra : rebase_source : a8a42a93324936c089ce9b1e9167dcef6fe14b2c
This commit is contained in:
Nicholas Nethercote 2015-11-01 18:41:57 -08:00
Родитель 20693def2e
Коммит 3fe818ed43
3 изменённых файлов: 10 добавлений и 27 удалений

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

@ -178,18 +178,6 @@ nsControllerCommandTable::GetCommandState(const char* aCommandName,
aCommandRefCon);
}
static PLDHashOperator
AddCommand(const nsACString& aKey, nsIControllerCommand* aData, void* aArg)
{
// aArg is a pointer to a array of strings. It gets incremented after
// allocating each one so that it points to the next location for AddCommand
// to assign a string to.
char*** commands = static_cast<char***>(aArg);
(**commands) = ToNewCString(aKey);
(*commands)++;
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
nsControllerCommandTable::GetSupportedCommands(uint32_t* aCount,
char*** aCommands)
@ -199,7 +187,10 @@ nsControllerCommandTable::GetSupportedCommands(uint32_t* aCount,
*aCount = mCommandsTable.Count();
*aCommands = commands;
mCommandsTable.EnumerateRead(AddCommand, &commands);
for (auto iter = mCommandsTable.Iter(); !iter.Done(); iter.Next()) {
*commands = ToNewCString(iter.Key());
commands++;
}
return NS_OK;
}

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

@ -593,7 +593,12 @@ nsWebBrowserPersist::SerializeNextFile()
// number of times this method is called. If it becomes a
// bottleneck, the count of not-yet-persisted URIs could be
// maintained separately.
mURIMap.EnumerateRead(EnumCountURIsToPersist, &urisToPersist);
for (auto iter = mURIMap.Iter(); !iter.Done(); iter.Next()) {
URIData *data = iter.UserData();
if (data->mNeedsPersisting && !data->mSaved) {
urisToPersist++;
}
}
}
if (urisToPersist > 0) {
@ -2436,17 +2441,6 @@ nsWebBrowserPersist::EnumCalcUploadProgress(nsISupports *aKey, UploadData *aData
return PL_DHASH_NEXT;
}
PLDHashOperator
nsWebBrowserPersist::EnumCountURIsToPersist(const nsACString &aKey, URIData *aData, void* aClosure)
{
uint32_t *count = static_cast<uint32_t*>(aClosure);
if (aData->mNeedsPersisting && !aData->mSaved)
{
(*count)++;
}
return PL_DHASH_NEXT;
}
PLDHashOperator
nsWebBrowserPersist::EnumPersistURIs(const nsACString &aKey, URIData *aData, void* aClosure)
{

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

@ -149,8 +149,6 @@ private:
nsISupports *aKey, UploadData *aData, void* aClosure);
static PLDHashOperator EnumFixRedirect(
nsISupports *aKey, OutputData *aData, void* aClosure);
static PLDHashOperator EnumCountURIsToPersist(
const nsACString &aKey, URIData *aData, void* aClosure);
static PLDHashOperator EnumCopyURIsToFlatMap(
const nsACString &aKey, URIData *aData, void* aClosure);