no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / quota / ActorsChild.h
blobdf1881b234519a6a11d11b9ecc3e5b95beee14d1
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 void AssertIsOnOwningThread() const
48 #ifdef DEBUG
50 #else
53 #endif
55 private:
56 // Only created by QuotaManagerService.
57 explicit QuotaChild(QuotaManagerService* aService);
59 // Only destroyed by mozilla::ipc::BackgroundChildImpl.
60 ~QuotaChild();
62 // IPDL methods are only called by IPDL.
63 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
65 virtual PQuotaUsageRequestChild* AllocPQuotaUsageRequestChild(
66 const UsageRequestParams& aParams) override;
68 virtual bool DeallocPQuotaUsageRequestChild(
69 PQuotaUsageRequestChild* aActor) override;
71 virtual PQuotaRequestChild* AllocPQuotaRequestChild(
72 const RequestParams& aParams) override;
74 virtual bool DeallocPQuotaRequestChild(PQuotaRequestChild* aActor) override;
77 class QuotaUsageRequestChild final : public PQuotaUsageRequestChild {
78 friend class QuotaChild;
79 friend class QuotaManagerService;
81 RefPtr<UsageRequest> mRequest;
83 public:
84 void AssertIsOnOwningThread() const
85 #ifdef DEBUG
87 #else
90 #endif
92 private:
93 // Only created by QuotaManagerService.
94 explicit QuotaUsageRequestChild(UsageRequest* aRequest);
96 // Only destroyed by QuotaChild.
97 ~QuotaUsageRequestChild();
99 void HandleResponse(nsresult aResponse);
101 void HandleResponse(const nsTArray<OriginUsage>& aResponse);
103 void HandleResponse(const OriginUsageResponse& aResponse);
105 // IPDL methods are only called by IPDL.
106 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
108 virtual mozilla::ipc::IPCResult Recv__delete__(
109 const UsageRequestResponse& aResponse) override;
112 class QuotaRequestChild final : public PQuotaRequestChild {
113 friend class QuotaChild;
114 friend class QuotaManagerService;
116 RefPtr<Request> mRequest;
118 public:
119 void AssertIsOnOwningThread() const
120 #ifdef DEBUG
122 #else
125 #endif
127 private:
128 // Only created by QuotaManagerService.
129 explicit QuotaRequestChild(Request* aRequest);
131 // Only destroyed by QuotaChild.
132 ~QuotaRequestChild();
134 void HandleResponse(nsresult aResponse);
136 void HandleResponse();
138 void HandleResponse(bool aResponse);
140 void HandleResponse(const nsAString& aResponse);
142 void HandleResponse(const EstimateResponse& aResponse);
144 void HandleResponse(const nsTArray<nsCString>& aResponse);
146 void HandleResponse(const GetFullOriginMetadataResponse& aResponse);
148 // IPDL methods are only called by IPDL.
149 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
151 virtual mozilla::ipc::IPCResult Recv__delete__(
152 const RequestResponse& aResponse) override;
155 } // namespace dom::quota
156 } // namespace mozilla
158 #endif // mozilla_dom_quota_ActorsChild_h