mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1919556 - FS: Call the callback immediately if there are no promises to settle in FileSystemManagerChild::CloseAllWritables; r=dom-storage-reviewers,jari
FileSystemManagerChild::CloseAllWritables is sometimes called from FileSystemManager::Shutdown which can be called late in application shutdown when GetCurrentSerialEventTarget returns null. At that point there are no writable file streams and the problem with GetCurrentSerialEventTarget returning null can be solved by calling the callback directly without dispatching a new runnable. Differential Revision: https://phabricator.services.mozilla.com/D221614
This commit is contained in:
parent
174389c55c
commit
dd3b50210c
@ -27,6 +27,17 @@ void FileSystemManagerChild::CloseAllWritables(
|
||||
nsTArray<RefPtr<BoolPromise>> promises;
|
||||
CloseAllWritablesImpl(promises);
|
||||
|
||||
// FileSystemManagerChild::CloseAllWritables is sometimes called from
|
||||
// FileSystemManager::Shutdown which can be called late in app shutdown
|
||||
// when GetCurrentSerialEventTarget returns null. At that point there
|
||||
// are no writable file streams. The problem with GetCurrentSerialEventTarget
|
||||
// returning null can be solved by calling the callback directly without
|
||||
// dispatching a new runnable.
|
||||
if (promises.IsEmpty()) {
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
BoolPromise::AllSettled(GetCurrentSerialEventTarget(), promises)
|
||||
->Then(GetCurrentSerialEventTarget(), __func__,
|
||||
[callback = std::move(aCallback)](
|
||||
|
Loading…
x
Reference in New Issue
Block a user