mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157029 - More changes to bulletproof shutdown of failed connections, r=janv.
This commit is contained in:
parent
b9e62b0591
commit
5c08f8889a
@ -6626,9 +6626,6 @@ private:
|
||||
nsresult
|
||||
EnsureDatabaseActorIsAlive();
|
||||
|
||||
void
|
||||
CleanupBackgroundThreadObjects(bool aInvalidate);
|
||||
|
||||
void
|
||||
MetadataToSpec(DatabaseSpec& aSpec);
|
||||
|
||||
@ -17119,10 +17116,6 @@ OpenDatabaseOp::ActorDestroy(ActorDestroyReason aWhy)
|
||||
|
||||
FactoryOp::ActorDestroy(aWhy);
|
||||
|
||||
if (aWhy != Deletion) {
|
||||
CleanupBackgroundThreadObjects(/* aInvalidate */ true);
|
||||
}
|
||||
|
||||
if (mVersionChangeOp) {
|
||||
mVersionChangeOp->NoteActorDestroyed();
|
||||
}
|
||||
@ -17907,7 +17900,25 @@ OpenDatabaseOp::SendResults()
|
||||
PBackgroundIDBFactoryRequestParent::Send__delete__(this, response);
|
||||
}
|
||||
|
||||
CleanupBackgroundThreadObjects(NS_FAILED(mResultCode));
|
||||
if (mDatabase) {
|
||||
MOZ_ASSERT(!mOfflineStorage);
|
||||
|
||||
if (NS_FAILED(mResultCode)) {
|
||||
mDatabase->Invalidate();
|
||||
}
|
||||
|
||||
// Make sure to release the database on this thread.
|
||||
mDatabase = nullptr;
|
||||
} else if (mOfflineStorage) {
|
||||
mOfflineStorage->CloseOnOwningThread();
|
||||
|
||||
nsCOMPtr<nsIRunnable> callback =
|
||||
NS_NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
|
||||
|
||||
nsRefPtr<WaitForTransactionsHelper> helper =
|
||||
new WaitForTransactionsHelper(mDatabaseId, callback);
|
||||
helper->WaitForTransactions();
|
||||
}
|
||||
|
||||
FinishSendResults();
|
||||
}
|
||||
@ -17999,33 +18010,6 @@ OpenDatabaseOp::EnsureDatabaseActorIsAlive()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
OpenDatabaseOp::CleanupBackgroundThreadObjects(bool aInvalidate)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(IsActorDestroyed());
|
||||
|
||||
if (mDatabase) {
|
||||
MOZ_ASSERT(!mOfflineStorage);
|
||||
|
||||
if (aInvalidate) {
|
||||
mDatabase->Invalidate();
|
||||
}
|
||||
|
||||
// Make sure to release the database on this thread.
|
||||
mDatabase = nullptr;
|
||||
} else if (mOfflineStorage) {
|
||||
mOfflineStorage->CloseOnOwningThread();
|
||||
|
||||
nsCOMPtr<nsIRunnable> callback =
|
||||
NS_NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
|
||||
|
||||
nsRefPtr<WaitForTransactionsHelper> helper =
|
||||
new WaitForTransactionsHelper(mDatabaseId, callback);
|
||||
helper->WaitForTransactions();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OpenDatabaseOp::MetadataToSpec(DatabaseSpec& aSpec)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user