Bug 1641231 - Reduce the usage for passing raw pointers in RegisterNormalOriginOp/UnregisterNormalOriginOp; r=dom-workers-and-storage-reviewers,sg

Differential Revision: https://phabricator.services.mozilla.com/D77078
This commit is contained in:
Tom Tung 2020-05-29 12:34:57 +00:00
Родитель 061f3b01c3
Коммит 3ee1a7f56f
1 изменённых файлов: 8 добавлений и 8 удалений

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

@ -1985,21 +1985,21 @@ StaticAutoPtr<NormalOriginOpArray> gNormalOriginOps;
// Constants for temporary storage limit computing.
static const uint32_t kDefaultChunkSizeKB = 10 * 1024;
void RegisterNormalOriginOp(NormalOriginOperationBase* aNormalOriginOp) {
void RegisterNormalOriginOp(NormalOriginOperationBase& aNormalOriginOp) {
AssertIsOnBackgroundThread();
if (!gNormalOriginOps) {
gNormalOriginOps = new NormalOriginOpArray();
}
gNormalOriginOps->AppendElement(aNormalOriginOp);
gNormalOriginOps->AppendElement(&aNormalOriginOp);
}
void UnregisterNormalOriginOp(NormalOriginOperationBase* aNormalOriginOp) {
void UnregisterNormalOriginOp(NormalOriginOperationBase& aNormalOriginOp) {
AssertIsOnBackgroundThread();
MOZ_ASSERT(gNormalOriginOps);
gNormalOriginOps->RemoveElement(aNormalOriginOp);
gNormalOriginOps->RemoveElement(&aNormalOriginOp);
if (gNormalOriginOps->IsEmpty()) {
gNormalOriginOps = nullptr;
@ -4285,7 +4285,7 @@ void QuotaManager::UpdateOriginAccessTime(PersistenceType aPersistenceType,
auto op = MakeRefPtr<SaveOriginAccessTimeOp>(aPersistenceType, aOrigin,
timestamp);
RegisterNormalOriginOp(op);
RegisterNormalOriginOp(*op);
op->RunImmediately();
}
@ -8475,7 +8475,7 @@ void NormalOriginOperationBase::UnblockOpen() {
mDirectoryLock = nullptr;
}
UnregisterNormalOriginOp(this);
UnregisterNormalOriginOp(*this);
AdvanceState();
}
@ -8811,7 +8811,7 @@ PQuotaUsageRequestParent* Quota::AllocPQuotaUsageRequestParent(
MOZ_ASSERT(actor);
RegisterNormalOriginOp(actor);
RegisterNormalOriginOp(*actor);
// Transfer ownership to IPDL.
return actor.forget().take();
@ -8917,7 +8917,7 @@ PQuotaRequestParent* Quota::AllocPQuotaRequestParent(
MOZ_ASSERT(actor);
RegisterNormalOriginOp(actor);
RegisterNormalOriginOp(*actor);
// Transfer ownership to IPDL.
return actor.forget().take();