/src/mozilla-central/dom/quota/ActorsChild.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #ifndef mozilla_dom_quota_ActorsChild_h |
8 | | #define mozilla_dom_quota_ActorsChild_h |
9 | | |
10 | | #include "mozilla/dom/quota/PQuotaChild.h" |
11 | | #include "mozilla/dom/quota/PQuotaRequestChild.h" |
12 | | #include "mozilla/dom/quota/PQuotaUsageRequestChild.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace ipc { |
16 | | |
17 | | class BackgroundChildImpl; |
18 | | |
19 | | } // namespace ipc |
20 | | |
21 | | namespace dom { |
22 | | namespace quota { |
23 | | |
24 | | class QuotaManagerService; |
25 | | class Request; |
26 | | class UsageRequest; |
27 | | |
28 | | class QuotaChild final |
29 | | : public PQuotaChild |
30 | | { |
31 | | friend class mozilla::ipc::BackgroundChildImpl; |
32 | | friend class QuotaManagerService; |
33 | | |
34 | | QuotaManagerService* mService; |
35 | | |
36 | | #ifdef DEBUG |
37 | | nsCOMPtr<nsIEventTarget> mOwningThread; |
38 | | #endif |
39 | | |
40 | | public: |
41 | | void |
42 | | AssertIsOnOwningThread() const |
43 | | #ifdef DEBUG |
44 | | ; |
45 | | #else |
46 | 0 | { } |
47 | | #endif |
48 | | |
49 | | private: |
50 | | // Only created by QuotaManagerService. |
51 | | explicit QuotaChild(QuotaManagerService* aService); |
52 | | |
53 | | // Only destroyed by mozilla::ipc::BackgroundChildImpl. |
54 | | ~QuotaChild(); |
55 | | |
56 | | // IPDL methods are only called by IPDL. |
57 | | virtual void |
58 | | ActorDestroy(ActorDestroyReason aWhy) override; |
59 | | |
60 | | virtual PQuotaUsageRequestChild* |
61 | | AllocPQuotaUsageRequestChild(const UsageRequestParams& aParams) override; |
62 | | |
63 | | virtual bool |
64 | | DeallocPQuotaUsageRequestChild(PQuotaUsageRequestChild* aActor) override; |
65 | | |
66 | | virtual PQuotaRequestChild* |
67 | | AllocPQuotaRequestChild(const RequestParams& aParams) override; |
68 | | |
69 | | virtual bool |
70 | | DeallocPQuotaRequestChild(PQuotaRequestChild* aActor) override; |
71 | | }; |
72 | | |
73 | | class QuotaUsageRequestChild final |
74 | | : public PQuotaUsageRequestChild |
75 | | { |
76 | | friend class QuotaChild; |
77 | | friend class QuotaManagerService; |
78 | | |
79 | | RefPtr<UsageRequest> mRequest; |
80 | | |
81 | | public: |
82 | | void |
83 | | AssertIsOnOwningThread() const |
84 | | #ifdef DEBUG |
85 | | ; |
86 | | #else |
87 | 0 | { } |
88 | | #endif |
89 | | |
90 | | private: |
91 | | // Only created by QuotaManagerService. |
92 | | explicit QuotaUsageRequestChild(UsageRequest* aRequest); |
93 | | |
94 | | // Only destroyed by QuotaChild. |
95 | | ~QuotaUsageRequestChild(); |
96 | | |
97 | | void |
98 | | HandleResponse(nsresult aResponse); |
99 | | |
100 | | void |
101 | | HandleResponse(const nsTArray<OriginUsage>& aResponse); |
102 | | |
103 | | void |
104 | | HandleResponse(const OriginUsageResponse& aResponse); |
105 | | |
106 | | // IPDL methods are only called by IPDL. |
107 | | virtual void |
108 | | ActorDestroy(ActorDestroyReason aWhy) override; |
109 | | |
110 | | virtual mozilla::ipc::IPCResult |
111 | | Recv__delete__(const UsageRequestResponse& aResponse) override; |
112 | | }; |
113 | | |
114 | | class QuotaRequestChild final |
115 | | : public PQuotaRequestChild |
116 | | { |
117 | | friend class QuotaChild; |
118 | | friend class QuotaManagerService; |
119 | | |
120 | | RefPtr<Request> mRequest; |
121 | | |
122 | | public: |
123 | | void |
124 | | AssertIsOnOwningThread() const |
125 | | #ifdef DEBUG |
126 | | ; |
127 | | #else |
128 | 0 | { } |
129 | | #endif |
130 | | |
131 | | private: |
132 | | // Only created by QuotaManagerService. |
133 | | explicit QuotaRequestChild(Request* aRequest); |
134 | | |
135 | | // Only destroyed by QuotaChild. |
136 | | ~QuotaRequestChild(); |
137 | | |
138 | | void |
139 | | HandleResponse(nsresult aResponse); |
140 | | |
141 | | void |
142 | | HandleResponse(); |
143 | | |
144 | | void |
145 | | HandleResponse(bool aResponse); |
146 | | |
147 | | // IPDL methods are only called by IPDL. |
148 | | virtual void |
149 | | ActorDestroy(ActorDestroyReason aWhy) override; |
150 | | |
151 | | virtual mozilla::ipc::IPCResult |
152 | | Recv__delete__(const RequestResponse& aResponse) override; |
153 | | }; |
154 | | |
155 | | } // namespace quota |
156 | | } // namespace dom |
157 | | } // namespace mozilla |
158 | | |
159 | | #endif // mozilla_dom_quota_ActorsChild_h |