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