Bug 1665890 - Use QM_TRY_RETURN where possible; r=dom-workers-and-storage-reviewers,ttung

Differential Revision: https://phabricator.services.mozilla.com/D90679
This commit is contained in:
Jan Varga 2020-09-22 14:21:52 +00:00
Родитель 63434c4e40
Коммит 45dd2a39a3
2 изменённых файлов: 7 добавлений и 17 удалений

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

@ -697,8 +697,7 @@ mozilla::Result<mozilla::Ok, nsresult> CollectWhileHasResult(
mozIStorageStatement& aStmt, StepFunc&& aStepFunc) {
return CollectWhile(
[&aStmt]() -> Result<bool, nsresult> {
IDB_TRY_VAR(auto hasResult, MOZ_TO_RESULT_INVOKE(aStmt, ExecuteStep));
return hasResult;
IDB_TRY_RETURN(MOZ_TO_RESULT_INVOKE(aStmt, ExecuteStep));
},
[&aStmt, &aStepFunc] { return aStepFunc(aStmt); });
}
@ -12835,11 +12834,8 @@ nsresult FileManager::InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
IDB_TRY(CollectEach(
[&entries]() -> Result<nsCOMPtr<nsIFile>, nsresult> {
IDB_TRY_VAR(
auto file,
ToResultInvoke<nsCOMPtr<nsIFile>>(
IDB_TRY_RETURN(ToResultInvoke<nsCOMPtr<nsIFile>>(
std::mem_fn(&nsIDirectoryEnumerator::GetNextFile), entries));
return file;
},
[&hasJournals](
const nsCOMPtr<nsIFile>& file) -> Result<mozilla::Ok, nsresult> {
@ -12950,11 +12946,8 @@ Result<FileUsageType, nsresult> FileManager::GetUsage(nsIFile* aDirectory) {
IDB_TRY(CollectEach(
[&entries]() -> Result<nsCOMPtr<nsIFile>, nsresult> {
IDB_TRY_VAR(
auto file,
ToResultInvoke<nsCOMPtr<nsIFile>>(
IDB_TRY_RETURN(ToResultInvoke<nsCOMPtr<nsIFile>>(
std::mem_fn(&nsIDirectoryEnumerator::GetNextFile), entries));
return file;
},
[&usage](const nsCOMPtr<nsIFile>& file) -> Result<mozilla::Ok, nsresult> {
IDB_TRY_VAR(

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

@ -659,11 +659,8 @@ Result<mozilla::Ok, nsresult> CollectEachFileEntry(
return CollectEach(
[&entries]() -> Result<nsCOMPtr<nsIFile>, nsresult> {
QM_TRY_VAR(const auto file,
MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<nsIFile>, entries,
QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr<nsIFile>, entries,
GetNextFile));
return file;
},
[&aFileFunc, &aDirectoryFunc](
const nsCOMPtr<nsIFile>& file) -> Result<mozilla::Ok, nsresult> {