mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 1626973 - Add assertions for result of MaybeUpdateSize. r=janv,dom-workers-and-storage-reviewers
Depends on D69580 Differential Revision: https://phabricator.services.mozilla.com/D69587 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1ca11f861a
commit
2e68c75bb1
@ -21,7 +21,9 @@ NS_IMETHODIMP FileQuotaStream<FileStreamBase>::SetEOF() {
|
||||
nsresult rv = FileStreamBase::Tell(&offset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mQuotaObject->MaybeUpdateSize(offset, /* aTruncate */ true);
|
||||
DebugOnly<bool> res =
|
||||
mQuotaObject->MaybeUpdateSize(offset, /* aTruncate */ true);
|
||||
MOZ_ASSERT(res);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -51,7 +53,9 @@ nsresult FileQuotaStream<FileStreamBase>::DoOpen() {
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mQuotaObject && (FileStreamBase::mOpenParams.ioFlags & PR_TRUNCATE)) {
|
||||
mQuotaObject->MaybeUpdateSize(0, /* aTruncate */ true);
|
||||
DebugOnly<bool> res =
|
||||
mQuotaObject->MaybeUpdateSize(0, /* aTruncate */ true);
|
||||
MOZ_ASSERT(res);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -32,7 +32,7 @@ class QuotaObject {
|
||||
|
||||
const nsAString& Path() const { return mPath; }
|
||||
|
||||
bool MaybeUpdateSize(int64_t aSize, bool aTruncate);
|
||||
[[nodiscard]] bool MaybeUpdateSize(int64_t aSize, bool aTruncate);
|
||||
|
||||
bool IncreaseSize(int64_t aDelta);
|
||||
|
||||
|
@ -276,7 +276,9 @@ int xWrite(sqlite3_file* pFile, const void* zBuf, int iAmt,
|
||||
"update its current size...");
|
||||
sqlite_int64 currentSize;
|
||||
if (xFileSize(pFile, ¤tSize) == SQLITE_OK) {
|
||||
p->quotaObject->MaybeUpdateSize(currentSize, /* aTruncate */ true);
|
||||
DebugOnly<bool> res =
|
||||
p->quotaObject->MaybeUpdateSize(currentSize, /* aTruncate */ true);
|
||||
MOZ_ASSERT(res);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
@ -315,7 +317,9 @@ int xTruncate(sqlite3_file* pFile, sqlite_int64 size) {
|
||||
"xTruncate failed on a quota-controlled file, attempting to "
|
||||
"update its current size...");
|
||||
if (xFileSize(pFile, &size) == SQLITE_OK) {
|
||||
p->quotaObject->MaybeUpdateSize(size, /* aTruncate */ true);
|
||||
DebugOnly<bool> res =
|
||||
p->quotaObject->MaybeUpdateSize(size, /* aTruncate */ true);
|
||||
MOZ_ASSERT(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user