Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / dom / quota / ActorsChild.h
blobc6712efdec4c241a76eef441e76b0fa9856b73ac
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 {
31 namespace quota {
33 class QuotaManagerService;
34 class Request;
35 class UsageRequest;
37 class QuotaChild final : public PQuotaChild {
38 friend class mozilla::ipc::BackgroundChildImpl;
39 friend class QuotaManagerService;
41 QuotaManagerService* mService;
43 #ifdef DEBUG
44 nsCOMPtr<nsIEventTarget> mOwningThread;
45 #endif
47 public:
48 void AssertIsOnOwningThread() const
49 #ifdef DEBUG
51 #else
54 #endif
56 private:
57 // Only created by QuotaManagerService.
58 explicit QuotaChild(QuotaManagerService* aService);
60 // Only destroyed by mozilla::ipc::BackgroundChildImpl.
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 // IPDL methods are only called by IPDL.
148 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
150 virtual mozilla::ipc::IPCResult Recv__delete__(
151 const RequestResponse& aResponse) override;
154 } // namespace quota
155 } // namespace dom
156 } // namespace mozilla
158 #endif // mozilla_dom_quota_ActorsChild_h