Bug 1910848 - Switch PQuotaUsageRequest to non-virtual implementation; r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D194214
This commit is contained in:
Jan Varga
2024-08-08 10:34:04 +00:00
parent c0ca609303
commit f29ffc1477
9 changed files with 24 additions and 23 deletions

View File

@@ -8,7 +8,6 @@ namespace mozilla {
namespace dom {
namespace quota {
[ChildImpl=virtual, ParentImpl=virtual]
protocol PQuotaUsageRequest
{
manager PQuota;

View File

@@ -12,7 +12,6 @@
#include "QuotaManager.h"
#include "QuotaRequests.h"
#include "QuotaResults.h"
#include "QuotaUsageRequestChild.h"
// Global includes
#include <cstdint>
@@ -34,6 +33,7 @@
#include "mozilla/Variant.h"
#include "mozilla/dom/quota/PQuota.h"
#include "mozilla/dom/quota/PersistenceType.h"
#include "mozilla/dom/quota/QuotaUsageRequestChild.h"
#include "mozilla/dom/quota/ResultExtensions.h"
#include "mozilla/fallible.h"
#include "mozilla/hal_sandbox/PHal.h"

View File

@@ -13,13 +13,13 @@
#include "mozilla/dom/quota/PQuota.h"
#include "mozilla/dom/quota/PQuotaRequestParent.h"
#include "mozilla/dom/quota/PQuotaUsageRequestParent.h"
#include "mozilla/dom/quota/QuotaUsageRequestParent.h"
#include "mozilla/dom/quota/ResultExtensions.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "nsDebug.h"
#include "nsError.h"
#include "OriginOperations.h"
#include "QuotaRequestBase.h"
#include "QuotaUsageRequestParent.h"
// CUF == CRASH_UNLESS_FUZZING
#define QM_CUF_AND_IPC_FAIL(actor) \

View File

@@ -8,7 +8,6 @@
// Local includes
#include "ActorsChild.h"
#include "QuotaUsageRequestChild.h"
// Global includes
#include "mozilla/ErrorNames.h"
@@ -19,6 +18,7 @@
#include "nsIVariant.h"
#include "nsStringFwd.h"
#include "nscore.h"
#include "mozilla/dom/quota/QuotaUsageRequestChild.h"
namespace mozilla {
class Runnable;

View File

@@ -36,6 +36,13 @@ void QuotaUsageRequestChild::AssertIsOnOwningThread() const {
#endif // DEBUG
mozilla::ipc::IPCResult QuotaUsageRequestChild::Recv__delete__() {
AssertIsOnOwningThread();
MOZ_ASSERT(mRequest);
return IPC_OK();
}
void QuotaUsageRequestChild::ActorDestroy(ActorDestroyReason aWhy) {
AssertIsOnOwningThread();
@@ -47,11 +54,4 @@ void QuotaUsageRequestChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}
mozilla::ipc::IPCResult QuotaUsageRequestChild::Recv__delete__() {
AssertIsOnOwningThread();
MOZ_ASSERT(mRequest);
return IPC_OK();
}
} // namespace mozilla::dom::quota

View File

@@ -33,6 +33,9 @@ class QuotaUsageRequestChild final : public PQuotaUsageRequestChild {
NS_INLINE_DECL_REFCOUNTING(QuotaUsageRequestChild, override)
// IPDL methods are only called by IPDL.
virtual mozilla::ipc::IPCResult Recv__delete__() override;
private:
// Only created by QuotaManagerService.
explicit QuotaUsageRequestChild(UsageRequest* aRequest);
@@ -40,10 +43,7 @@ class QuotaUsageRequestChild final : public PQuotaUsageRequestChild {
// Only destroyed by QuotaChild.
~QuotaUsageRequestChild();
// IPDL methods are only called by IPDL.
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual mozilla::ipc::IPCResult Recv__delete__() override;
};
} // namespace mozilla::dom::quota

View File

@@ -26,12 +26,6 @@ void QuotaUsageRequestParent::Destroy() {
}
}
void QuotaUsageRequestParent::ActorDestroy(ActorDestroyReason aWhy) {
AssertIsOnOwningThread();
mCancelPromiseHolder.RejectIfExists(NS_ERROR_FAILURE, __func__);
}
mozilla::ipc::IPCResult QuotaUsageRequestParent::RecvCancel() {
AssertIsOnOwningThread();
@@ -40,4 +34,10 @@ mozilla::ipc::IPCResult QuotaUsageRequestParent::RecvCancel() {
return IPC_OK();
}
void QuotaUsageRequestParent::ActorDestroy(ActorDestroyReason aWhy) {
AssertIsOnOwningThread();
mCancelPromiseHolder.RejectIfExists(NS_ERROR_FAILURE, __func__);
}
} // namespace mozilla::dom::quota

View File

@@ -24,14 +24,14 @@ class QuotaUsageRequestParent : public BackgroundThreadObject,
void Destroy();
// IPDL methods.
mozilla::ipc::IPCResult RecvCancel();
private:
virtual ~QuotaUsageRequestParent();
// IPDL methods.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvCancel() final;
MozPromiseHolder<BoolPromise> mCancelPromiseHolder;
};

View File

@@ -72,6 +72,8 @@ EXPORTS.mozilla.dom.quota += [
"QuotaManagerService.h",
"QuotaObject.h",
"QuotaParent.h",
"QuotaUsageRequestChild.h",
"QuotaUsageRequestParent.h",
"RemoteQuotaObjectChild.h",
"RemoteQuotaObjectParent.h",
"RemoteQuotaObjectParentTracker.h",