Bug 1910848 - Pull out OriginOperationBase::mActorDestroyed to actor classes; r=dom-storage-reviewers,jari
OriginOperationBase is finally fully abstract. Differential Revision: https://phabricator.services.mozilla.com/D194037
This commit is contained in:
@@ -44,8 +44,7 @@ OriginOperationBase::OriginOperationBase(
|
||||
MovingNotNull<RefPtr<QuotaManager>>&& aQuotaManager, const char* aName)
|
||||
: BackgroundThreadObject(GetCurrentSerialEventTarget()),
|
||||
mQuotaManager(std::move(aQuotaManager)),
|
||||
mResultCode(NS_OK),
|
||||
mActorDestroyed(false)
|
||||
mResultCode(NS_OK)
|
||||
#ifdef QM_COLLECTING_OPERATION_TELEMETRY
|
||||
,
|
||||
mName(aName)
|
||||
@@ -54,10 +53,7 @@ OriginOperationBase::OriginOperationBase(
|
||||
AssertIsOnOwningThread();
|
||||
}
|
||||
|
||||
OriginOperationBase::~OriginOperationBase() {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mActorDestroyed);
|
||||
}
|
||||
OriginOperationBase::~OriginOperationBase() { AssertIsOnOwningThread(); }
|
||||
|
||||
void OriginOperationBase::RunImmediately() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
@@ -29,8 +29,6 @@ class OriginOperationBase : public BackgroundThreadObject,
|
||||
nsresult mResultCode;
|
||||
|
||||
private:
|
||||
bool mActorDestroyed;
|
||||
|
||||
#ifdef QM_COLLECTING_OPERATION_TELEMETRY
|
||||
const char* mName = nullptr;
|
||||
#endif
|
||||
@@ -38,18 +36,6 @@ class OriginOperationBase : public BackgroundThreadObject,
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(OriginOperationBase)
|
||||
|
||||
void NoteActorDestroyed() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mActorDestroyed = true;
|
||||
}
|
||||
|
||||
bool IsActorDestroyed() const {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return mActorDestroyed;
|
||||
}
|
||||
|
||||
#ifdef QM_COLLECTING_OPERATION_TELEMETRY
|
||||
const char* Name() const { return mName; }
|
||||
#endif
|
||||
|
||||
@@ -962,10 +962,6 @@ nsresult FinalizeOriginEvictionOp::DoDirectoryWork(
|
||||
void FinalizeOriginEvictionOp::UnblockOpen() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
#ifdef DEBUG
|
||||
NoteActorDestroyed();
|
||||
#endif
|
||||
|
||||
for (const auto& lock : mLocks) {
|
||||
lock->Drop();
|
||||
}
|
||||
@@ -1010,11 +1006,7 @@ nsresult SaveOriginAccessTimeOp::DoDirectoryWork(QuotaManager& aQuotaManager) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void SaveOriginAccessTimeOp::SendResults() {
|
||||
#ifdef DEBUG
|
||||
NoteActorDestroyed();
|
||||
#endif
|
||||
}
|
||||
void SaveOriginAccessTimeOp::SendResults() {}
|
||||
|
||||
void SaveOriginAccessTimeOp::CloseDirectory() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace mozilla::dom::quota {
|
||||
|
||||
QuotaRequestBase::~QuotaRequestBase() {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mActorDestroyed);
|
||||
}
|
||||
|
||||
void QuotaRequestBase::SendResults() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
|
||||
@@ -19,7 +19,22 @@ class QuotaRequestBase : public NormalOriginOperationBase,
|
||||
protected:
|
||||
QuotaRequestBase(MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
|
||||
const char* aName)
|
||||
: NormalOriginOperationBase(std::move(aQuotaManager), aName) {}
|
||||
: NormalOriginOperationBase(std::move(aQuotaManager), aName),
|
||||
mActorDestroyed(false) {}
|
||||
|
||||
virtual ~QuotaRequestBase();
|
||||
|
||||
void NoteActorDestroyed() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mActorDestroyed = true;
|
||||
}
|
||||
|
||||
bool IsActorDestroyed() const {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return mActorDestroyed;
|
||||
}
|
||||
|
||||
// Subclasses use this override to set the IPDL response value.
|
||||
virtual void GetResponse(RequestResponse& aResponse) = 0;
|
||||
@@ -29,6 +44,8 @@ class QuotaRequestBase : public NormalOriginOperationBase,
|
||||
|
||||
// IPDL methods.
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
bool mActorDestroyed;
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom::quota
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace mozilla::dom::quota {
|
||||
|
||||
QuotaUsageRequestBase::~QuotaUsageRequestBase() {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mActorDestroyed);
|
||||
}
|
||||
|
||||
void QuotaUsageRequestBase::SendResults() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
|
||||
@@ -19,7 +19,22 @@ class QuotaUsageRequestBase : public NormalOriginOperationBase,
|
||||
protected:
|
||||
QuotaUsageRequestBase(MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
|
||||
const char* aName)
|
||||
: NormalOriginOperationBase(std::move(aQuotaManager), aName) {}
|
||||
: NormalOriginOperationBase(std::move(aQuotaManager), aName),
|
||||
mActorDestroyed(false) {}
|
||||
|
||||
virtual ~QuotaUsageRequestBase();
|
||||
|
||||
void NoteActorDestroyed() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mActorDestroyed = true;
|
||||
}
|
||||
|
||||
bool IsActorDestroyed() const {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return mActorDestroyed;
|
||||
}
|
||||
|
||||
// Subclasses use this override to set the IPDL response value.
|
||||
virtual void GetResponse(UsageRequestResponse& aResponse) = 0;
|
||||
@@ -31,6 +46,8 @@ class QuotaUsageRequestBase : public NormalOriginOperationBase,
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvCancel() final;
|
||||
|
||||
bool mActorDestroyed;
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom::quota
|
||||
|
||||
@@ -37,10 +37,6 @@ class ResolvableNormalOriginOp : public NormalOriginOperationBase {
|
||||
|
||||
private:
|
||||
void SendResults() override {
|
||||
#ifdef DEBUG
|
||||
NoteActorDestroyed();
|
||||
#endif
|
||||
|
||||
if (Canceled()) {
|
||||
mResultCode = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user