Bug 1908539 restrict MacOS platform audio processing to Nightly r=webrtc-reviewers...
[gecko.git] / dom / quota / ActorsChild.h
blob8b08e4924cfe0e302b8f25812fe8d661276bcd22
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_quota_ActorsChild_h
8 #define mozilla_dom_quota_ActorsChild_h
10 #include <cstdint>
11 #include "ErrorList.h"
12 #include "mozilla/RefPtr.h"
13 #include "mozilla/dom/quota/PQuotaChild.h"
14 #include "mozilla/dom/quota/PQuotaRequestChild.h"
15 #include "mozilla/dom/quota/PQuotaUsageRequestChild.h"
16 #include "mozilla/ipc/ProtocolUtils.h"
17 #include "nsCOMPtr.h"
18 #include "nsStringFwd.h"
19 #include "nsTArray.h"
21 class nsIEventTarget;
23 namespace mozilla {
24 namespace ipc {
26 class BackgroundChildImpl;
28 } // namespace ipc
30 namespace dom::quota {
32 class QuotaManagerService;
33 class Request;
34 class UsageRequest;
36 class QuotaChild final : public PQuotaChild {
37 friend class mozilla::ipc::BackgroundChildImpl;
38 friend class QuotaManagerService;
40 QuotaManagerService* mService;
42 #ifdef DEBUG
43 nsCOMPtr<nsIEventTarget> mOwningThread;
44 #endif
46 public:
47 NS_INLINE_DECL_REFCOUNTING(QuotaChild, override)
49 void AssertIsOnOwningThread() const
50 #ifdef DEBUG
52 #else
55 #endif
57 private:
58 // Only created by QuotaManagerService.
59 explicit QuotaChild(QuotaManagerService* aService);
61 ~QuotaChild();
63 // IPDL methods are only called by IPDL.
64 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
66 virtual PQuotaUsageRequestChild* AllocPQuotaUsageRequestChild(
67 const UsageRequestParams& aParams) override;
69 virtual bool DeallocPQuotaUsageRequestChild(
70 PQuotaUsageRequestChild* aActor) override;
72 virtual PQuotaRequestChild* AllocPQuotaRequestChild(
73 const RequestParams& aParams) override;
75 virtual bool DeallocPQuotaRequestChild(PQuotaRequestChild* aActor) override;
78 class QuotaUsageRequestChild final : public PQuotaUsageRequestChild {
79 friend class QuotaChild;
80 friend class QuotaManagerService;
82 RefPtr<UsageRequest> mRequest;
84 public:
85 void AssertIsOnOwningThread() const
86 #ifdef DEBUG
88 #else
91 #endif
93 private:
94 // Only created by QuotaManagerService.
95 explicit QuotaUsageRequestChild(UsageRequest* aRequest);
97 // Only destroyed by QuotaChild.
98 ~QuotaUsageRequestChild();
100 void HandleResponse(nsresult aResponse);
102 void HandleResponse(const nsTArray<OriginUsage>& aResponse);
104 void HandleResponse(const OriginUsageResponse& aResponse);
106 // IPDL methods are only called by IPDL.
107 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
109 virtual mozilla::ipc::IPCResult Recv__delete__(
110 const UsageRequestResponse& aResponse) override;
113 class QuotaRequestChild final : public PQuotaRequestChild {
114 friend class QuotaChild;
115 friend class QuotaManagerService;
117 RefPtr<Request> mRequest;
119 public:
120 void AssertIsOnOwningThread() const
121 #ifdef DEBUG
123 #else
126 #endif
128 private:
129 // Only created by QuotaManagerService.
130 explicit QuotaRequestChild(Request* aRequest);
132 // Only destroyed by QuotaChild.
133 ~QuotaRequestChild();
135 void HandleResponse(nsresult aResponse);
137 void HandleResponse();
139 void HandleResponse(bool aResponse);
141 void HandleResponse(const nsAString& aResponse);
143 void HandleResponse(const EstimateResponse& aResponse);
145 void HandleResponse(const nsTArray<nsCString>& aResponse);
147 void HandleResponse(const GetFullOriginMetadataResponse& aResponse);
149 // IPDL methods are only called by IPDL.
150 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
152 virtual mozilla::ipc::IPCResult Recv__delete__(
153 const RequestResponse& aResponse) override;
156 } // namespace dom::quota
157 } // namespace mozilla
159 #endif // mozilla_dom_quota_ActorsChild_h