Bug 1803062 - Expose the sync close operation using a dedicated method; r=smaug

This is a preparation for changing the internal Close method to be async.

Differential Revision: https://phabricator.services.mozilla.com/D164192
This commit is contained in:
Jan Varga 2022-12-16 06:38:06 +00:00
parent fe224998ea
commit 3042af06bf
3 changed files with 8 additions and 4 deletions

View File

@ -136,7 +136,7 @@ FileSystemSyncAccessHandle::Create(
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(workerPrivate, "FileSystemSyncAccessHandle",
[result]() { result->Close(); });
[result]() { result->CloseInternal(); });
QM_TRY(MOZ_TO_RESULT(workerRef));
autoClose.release();
@ -160,7 +160,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FileSystemSyncAccessHandle)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
// Don't unlink mManager!
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
tmp->Close();
tmp->CloseInternal();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(FileSystemSyncAccessHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobal)
@ -188,7 +188,7 @@ void FileSystemSyncAccessHandle::ClearActor() {
mActor = nullptr;
}
void FileSystemSyncAccessHandle::Close() {
void FileSystemSyncAccessHandle::CloseInternal() {
if (mClosed) {
return;
}
@ -284,6 +284,8 @@ void FileSystemSyncAccessHandle::Flush(ErrorResult& aError) {
mStream->OutputStream()->Flush();
}
void FileSystemSyncAccessHandle::Close() { CloseInternal(); }
uint64_t FileSystemSyncAccessHandle::ReadOrWrite(
const MaybeSharedArrayBufferViewOrMaybeSharedArrayBuffer& aBuffer,
const FileSystemReadWriteOptions& aOptions, const bool aRead,

View File

@ -43,6 +43,8 @@ class FileSystemSyncAccessHandle final : public nsISupports,
void ClearActor();
void CloseInternal();
// WebIDL Boilerplate
nsIGlobalObject* GetParentObject() const;

View File

@ -21,7 +21,7 @@ void FileSystemManagerChild::CloseAll() {
for (const auto& item : ManagedPFileSystemAccessHandleChild()) {
auto* child = static_cast<FileSystemAccessHandleChild*>(item);
child->MutableAccessHandlePtr()->Close();
child->MutableAccessHandlePtr()->CloseInternal();
}
for (const auto& item : ManagedPFileSystemWritableFileStreamChild()) {