зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1663924 - Use IDB_TRY in Maintenance::Run. r=dom-workers-and-storage-reviewers,ttung
Differential Revision: https://phabricator.services.mozilla.com/D93990
This commit is contained in:
Родитель
50d4600728
Коммит
0777f29688
|
@ -14155,53 +14155,53 @@ NS_IMETHODIMP
|
|||
Maintenance::Run() {
|
||||
MOZ_ASSERT(mState != State::Complete);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
switch (mState) {
|
||||
case State::Initial:
|
||||
rv = Start();
|
||||
break;
|
||||
|
||||
case State::CreateIndexedDatabaseManager:
|
||||
rv = CreateIndexedDatabaseManager();
|
||||
break;
|
||||
|
||||
case State::IndexedDatabaseManagerOpen:
|
||||
rv = OpenDirectory();
|
||||
break;
|
||||
|
||||
case State::DirectoryWorkOpen:
|
||||
rv = DirectoryWork();
|
||||
break;
|
||||
|
||||
case State::BeginDatabaseMaintenance:
|
||||
rv = BeginDatabaseMaintenance();
|
||||
break;
|
||||
|
||||
case State::Finishing:
|
||||
Finish();
|
||||
return NS_OK;
|
||||
|
||||
default:
|
||||
MOZ_CRASH("Bad state!");
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) && mState != State::Finishing) {
|
||||
const auto handleError = [this](const nsresult rv) {
|
||||
if (mState != State::Finishing) {
|
||||
if (NS_SUCCEEDED(mResultCode)) {
|
||||
mResultCode = rv;
|
||||
}
|
||||
|
||||
// Must set mState before dispatching otherwise we will race with the owning
|
||||
// thread.
|
||||
// Must set mState before dispatching otherwise we will race with the
|
||||
// owning thread.
|
||||
mState = State::Finishing;
|
||||
|
||||
if (IsOnBackgroundThread()) {
|
||||
Finish();
|
||||
} else {
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mQuotaClient->BackgroundThread()->Dispatch(this, NS_DISPATCH_NORMAL));
|
||||
MOZ_ALWAYS_SUCCEEDS(mQuotaClient->BackgroundThread()->Dispatch(
|
||||
this, NS_DISPATCH_NORMAL));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
switch (mState) {
|
||||
case State::Initial:
|
||||
IDB_TRY(Start(), NS_OK, handleError);
|
||||
break;
|
||||
|
||||
case State::CreateIndexedDatabaseManager:
|
||||
IDB_TRY(CreateIndexedDatabaseManager(), NS_OK, handleError);
|
||||
break;
|
||||
|
||||
case State::IndexedDatabaseManagerOpen:
|
||||
IDB_TRY(OpenDirectory(), NS_OK, handleError);
|
||||
break;
|
||||
|
||||
case State::DirectoryWorkOpen:
|
||||
IDB_TRY(DirectoryWork(), NS_OK, handleError);
|
||||
break;
|
||||
|
||||
case State::BeginDatabaseMaintenance:
|
||||
IDB_TRY(BeginDatabaseMaintenance(), NS_OK, handleError);
|
||||
break;
|
||||
|
||||
case State::Finishing:
|
||||
Finish();
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_CRASH("Bad state!");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче