зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1754448 - Rename snapshot usage related variables; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D138640
This commit is contained in:
Родитель
d3dde1f608
Коммит
5a84e4bfa4
|
@ -1593,7 +1593,7 @@ class Datastore final
|
|||
|
||||
void Clear(Database* aDatabase);
|
||||
|
||||
void BeginUpdateBatch(int64_t aSnapshotInitialUsage);
|
||||
void BeginUpdateBatch(int64_t aSnapshotUsage);
|
||||
|
||||
int64_t EndUpdateBatch(int64_t aSnapshotPeakUsage);
|
||||
|
||||
|
@ -1956,12 +1956,12 @@ class Snapshot final : public PBackgroundLSSnapshotParent {
|
|||
|
||||
void Init(nsTHashtable<nsStringHashKey>& aLoadedItems,
|
||||
nsTHashSet<nsString>&& aUnknownItems, uint32_t aNextLoadIndex,
|
||||
uint32_t aTotalLength, int64_t aInitialUsage, int64_t aPeakUsage,
|
||||
uint32_t aTotalLength, int64_t aUsage, int64_t aPeakUsage,
|
||||
LSSnapshot::LoadState aLoadState, bool aHasOtherProcessDatabases,
|
||||
bool aHasOtherProcessObservers) {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aInitialUsage >= 0);
|
||||
MOZ_ASSERT(aPeakUsage >= aInitialUsage);
|
||||
MOZ_ASSERT(aUsage >= 0);
|
||||
MOZ_ASSERT(aPeakUsage >= aUsage);
|
||||
MOZ_ASSERT_IF(aLoadState != LSSnapshot::LoadState::AllOrderedItems,
|
||||
aNextLoadIndex < aTotalLength);
|
||||
MOZ_ASSERT(mTotalLength == 0);
|
||||
|
@ -1972,7 +1972,7 @@ class Snapshot final : public PBackgroundLSSnapshotParent {
|
|||
mUnknownItems = std::move(aUnknownItems);
|
||||
mNextLoadIndex = aNextLoadIndex;
|
||||
mTotalLength = aTotalLength;
|
||||
mUsage = aInitialUsage;
|
||||
mUsage = aUsage;
|
||||
mPeakUsage = aPeakUsage;
|
||||
if (aLoadState == LSSnapshot::LoadState::AllOrderedKeys) {
|
||||
MOZ_ASSERT(mUnknownItems.Count() == 0);
|
||||
|
@ -4963,15 +4963,15 @@ void Datastore::Clear(Database* aDatabase) {
|
|||
}
|
||||
}
|
||||
|
||||
void Datastore::BeginUpdateBatch(int64_t aSnapshotInitialUsage) {
|
||||
void Datastore::BeginUpdateBatch(int64_t aSnapshotUsage) {
|
||||
AssertIsOnBackgroundThread();
|
||||
// Don't assert `aSnapshotInitialUsage >= 0`, it can be negative when multiple
|
||||
// Don't assert `aSnapshotUsage >= 0`, it can be negative when multiple
|
||||
// snapshots are operating in parallel.
|
||||
MOZ_ASSERT(!mClosed);
|
||||
MOZ_ASSERT(mUpdateBatchUsage == -1);
|
||||
MOZ_ASSERT(!mInUpdateBatch);
|
||||
|
||||
mUpdateBatchUsage = aSnapshotInitialUsage;
|
||||
mUpdateBatchUsage = aSnapshotUsage;
|
||||
|
||||
if (IsPersistent()) {
|
||||
mConnection->BeginUpdateBatch();
|
||||
|
@ -5560,9 +5560,9 @@ mozilla::ipc::IPCResult Database::RecvPBackgroundLSSnapshotConstructor(
|
|||
|
||||
uint32_t totalLength = mDatastore->GetLength();
|
||||
|
||||
int64_t initialUsage = mDatastore->GetUsage();
|
||||
int64_t usage = mDatastore->GetUsage();
|
||||
|
||||
int64_t peakUsage = initialUsage;
|
||||
int64_t peakUsage = usage;
|
||||
|
||||
if (aIncreasePeakUsage) {
|
||||
int64_t size =
|
||||
|
@ -5575,7 +5575,7 @@ mozilla::ipc::IPCResult Database::RecvPBackgroundLSSnapshotConstructor(
|
|||
bool hasOtherProcessObservers = mDatastore->HasOtherProcessObservers(this);
|
||||
|
||||
snapshot->Init(loadedItems, std::move(unknownItems), nextLoadIndex,
|
||||
totalLength, initialUsage, peakUsage, loadState,
|
||||
totalLength, usage, peakUsage, loadState,
|
||||
hasOtherProcessDatabases, hasOtherProcessObservers);
|
||||
|
||||
RegisterSnapshot(snapshot);
|
||||
|
@ -5583,7 +5583,7 @@ mozilla::ipc::IPCResult Database::RecvPBackgroundLSSnapshotConstructor(
|
|||
aInitInfo->addKeyToUnknownItems() = addKeyToUnknownItems;
|
||||
aInitInfo->itemInfos() = std::move(itemInfos);
|
||||
aInitInfo->totalLength() = totalLength;
|
||||
aInitInfo->initialUsage() = initialUsage;
|
||||
aInitInfo->usage() = usage;
|
||||
aInitInfo->peakUsage() = peakUsage;
|
||||
aInitInfo->loadState() = loadState;
|
||||
aInitInfo->hasOtherProcessDatabases() = hasOtherProcessDatabases;
|
||||
|
|
|
@ -135,7 +135,7 @@ LSSnapshot::LSSnapshot(LSDatabase* aDatabase)
|
|||
mActor(nullptr),
|
||||
mInitLength(0),
|
||||
mLength(0),
|
||||
mExactUsage(0),
|
||||
mUsage(0),
|
||||
mPeakUsage(0),
|
||||
mLoadState(LoadState::Initial),
|
||||
mHasOtherProcessDatabases(false),
|
||||
|
@ -212,7 +212,7 @@ nsresult LSSnapshot::Init(const nsAString& aKey,
|
|||
MOZ_ASSERT(loadState == LoadState::AllOrderedItems);
|
||||
}
|
||||
|
||||
mExactUsage = aInitInfo.initialUsage();
|
||||
mUsage = aInitInfo.usage();
|
||||
mPeakUsage = aInitInfo.peakUsage();
|
||||
|
||||
mLoadState = aInitInfo.loadState();
|
||||
|
@ -597,7 +597,7 @@ int64_t LSSnapshot::GetUsage() const {
|
|||
MOZ_ASSERT(mInitialized);
|
||||
MOZ_ASSERT(!mSentFinish);
|
||||
|
||||
return mExactUsage;
|
||||
return mUsage;
|
||||
}
|
||||
|
||||
void LSSnapshot::ScheduleStableStateCallback() {
|
||||
|
@ -894,13 +894,13 @@ nsresult LSSnapshot::UpdateUsage(int64_t aDelta) {
|
|||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mDatabase);
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_ASSERT(mPeakUsage >= mExactUsage);
|
||||
MOZ_ASSERT(mPeakUsage >= mUsage);
|
||||
MOZ_ASSERT(mInitialized);
|
||||
MOZ_ASSERT(!mSentFinish);
|
||||
|
||||
int64_t newExactUsage = mExactUsage + aDelta;
|
||||
if (newExactUsage > mPeakUsage) {
|
||||
const int64_t minSize = newExactUsage - mPeakUsage;
|
||||
int64_t newUsage = mUsage + aDelta;
|
||||
if (newUsage > mPeakUsage) {
|
||||
const int64_t minSize = newUsage - mPeakUsage;
|
||||
|
||||
int64_t size;
|
||||
if (NS_WARN_IF(!mActor->SendIncreasePeakUsage(minSize, &size))) {
|
||||
|
@ -916,7 +916,7 @@ nsresult LSSnapshot::UpdateUsage(int64_t aDelta) {
|
|||
mPeakUsage += size;
|
||||
}
|
||||
|
||||
mExactUsage = newExactUsage;
|
||||
mUsage = newUsage;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class LSSnapshot final : public nsIRunnable {
|
|||
|
||||
uint32_t mInitLength;
|
||||
uint32_t mLength;
|
||||
int64_t mExactUsage;
|
||||
int64_t mUsage;
|
||||
int64_t mPeakUsage;
|
||||
|
||||
LoadState mLoadState;
|
||||
|
|
|
@ -50,12 +50,12 @@ struct LSSnapshotInitInfo
|
|||
* The current amount of LocalStorage usage as measured by the summing the
|
||||
* nsString Length() of both the key and the value over all stored pairs.
|
||||
*/
|
||||
int64_t initialUsage;
|
||||
int64_t usage;
|
||||
|
||||
/**
|
||||
* The amount of storage allowed to be used by the Snapshot without requesting
|
||||
* more storage space via IncreasePeakUsage. This is the `initialUsage` plus
|
||||
* 0 or more bytes of space. If space was available, the increase will be the
|
||||
* more storage space via IncreasePeakUsage. This is the `usage` plus 0 or
|
||||
* more bytes of space. If space was available, the increase will be the
|
||||
* `minSize` from the PBackgroundLSSnapshot constructor plus the configured
|
||||
* pre-increment (via "dom.storage.snapshot_peak_usage.initial_preincrement").
|
||||
* If the LocalStorage total usage was already close to the limit, then the
|
||||
|
|
Загрузка…
Ссылка в новой задаче