Bug 1500343 - Part 9: Remove DatabaseOrMutableFile r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D160384
This commit is contained in:
Kagami Sascha Rosylight 2023-02-23 08:59:09 +00:00
Родитель 33d53c026f
Коммит b46e8a7897
3 изменённых файлов: 15 добавлений и 23 удалений

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

@ -10315,17 +10315,11 @@ bool TransactionBase::VerifyRequestParams(
}
for (const FileAddInfo& fileAddInfo : aParams.fileAddInfos()) {
const DatabaseOrMutableFile& file = fileAddInfo.file();
MOZ_ASSERT(file.type() != DatabaseOrMutableFile::T__None);
const PBackgroundIDBDatabaseFileParent* file = fileAddInfo.fileParent();
switch (fileAddInfo.type()) {
case StructuredCloneFileBase::eBlob:
if (NS_AUUF_OR_WARN_IF(
file.type() !=
DatabaseOrMutableFile::TPBackgroundIDBDatabaseFileParent)) {
return false;
}
if (NS_AUUF_OR_WARN_IF(!file.get_PBackgroundIDBDatabaseFileParent())) {
if (NS_AUUF_OR_WARN_IF(!file)) {
return false;
}
break;
@ -18485,16 +18479,13 @@ bool ObjectStoreAddOrPutRequestOp::Init(TransactionBase& aTransaction) {
fileAddInfo.type() ==
StructuredCloneFileBase::eMutableFile);
const DatabaseOrMutableFile& file = fileAddInfo.file();
switch (fileAddInfo.type()) {
case StructuredCloneFileBase::eBlob: {
MOZ_ASSERT(
file.type() ==
DatabaseOrMutableFile::TPBackgroundIDBDatabaseFileParent);
PBackgroundIDBDatabaseFileParent* file =
fileAddInfo.fileParent();
MOZ_ASSERT(file);
auto* const fileActor = static_cast<DatabaseFile*>(
file.get_PBackgroundIDBDatabaseFileParent());
auto* const fileActor = static_cast<DatabaseFile*>(file);
MOZ_ASSERT(fileActor);
return StoredFileInfo::CreateForBlob(

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

@ -769,7 +769,10 @@ RefPtr<IDBRequest> IDBObjectStore::AddOrPut(JSContext* aCx,
return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
}
return FileAddInfo{fileActor, StructuredCloneFileBase::eBlob};
FileAddInfo info{};
info.fileChild() = fileActor;
info.type() = StructuredCloneFileBase::eBlob;
return info;
}
case StructuredCloneFileBase::eWasmBytecode:
@ -784,7 +787,10 @@ RefPtr<IDBRequest> IDBObjectStore::AddOrPut(JSContext* aCx,
return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
}
return FileAddInfo{fileActor, file.Type()};
FileAddInfo info{};
info.fileChild() = fileActor;
info.type() = file.Type();
return info;
}
default:

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

@ -161,14 +161,9 @@ union OpenCursorParams
IndexOpenKeyCursorParams;
};
union DatabaseOrMutableFile
{
PBackgroundIDBDatabaseFile;
};
struct FileAddInfo
{
DatabaseOrMutableFile file;
PBackgroundIDBDatabaseFile file;
FileType type;
};