Bug 1617170 - Reduce statefulness of CreateFileOp. r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D63653

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-03-02 16:15:49 +00:00
Родитель d6331fa826
Коммит 63850cb6a7
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -7164,7 +7164,7 @@ class DatabaseOp : public DatabaseOperationBase,
class CreateFileOp final : public DatabaseOp {
const CreateFileParams mParams;
RefPtr<FileInfo> mFileInfo;
InitializedOnce<const RefPtr<FileInfo>, LazyInit::Allow> mFileInfo;
public:
CreateFileOp(Database* aDatabase, const DatabaseRequestParams& aParams);
@ -23294,14 +23294,14 @@ CreateFileOp::CreateFileOp(Database* aDatabase,
}
nsresult CreateFileOp::CreateMutableFile(RefPtr<MutableFile>* aMutableFile) {
nsCOMPtr<nsIFile> file = FileInfo::GetFileForFileInfo(mFileInfo);
nsCOMPtr<nsIFile> file = FileInfo::GetFileForFileInfo(*mFileInfo);
if (NS_WARN_IF(!file)) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
RefPtr<MutableFile> mutableFile =
MutableFile::Create(file, mDatabase, mFileInfo);
MutableFile::Create(file, mDatabase, *mFileInfo);
if (NS_WARN_IF(!mutableFile)) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
@ -23333,13 +23333,13 @@ nsresult CreateFileOp::DoDatabaseWork() {
FileManager* fileManager = mDatabase->GetFileManager();
mFileInfo = fileManager->GetNewFileInfo();
if (NS_WARN_IF(!mFileInfo)) {
mFileInfo.init(fileManager->GetNewFileInfo());
if (NS_WARN_IF(!*mFileInfo)) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
const int64_t fileId = mFileInfo->Id();
const int64_t fileId = (*mFileInfo)->Id();
const auto journalDirectory = fileManager->EnsureJournalDirectory();
if (NS_WARN_IF(!journalDirectory)) {