/src/mozilla-central/dom/simpledb/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_simpledb_ActorsChild_h |
8 | | #define mozilla_dom_simpledb_ActorsChild_h |
9 | | |
10 | | #include "mozilla/dom/PBackgroundSDBConnectionChild.h" |
11 | | #include "mozilla/dom/PBackgroundSDBRequestChild.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace ipc { |
15 | | |
16 | | class BackgroundChildImpl; |
17 | | |
18 | | } // namespace ipc |
19 | | |
20 | | namespace dom { |
21 | | |
22 | | class SDBConnection; |
23 | | class SDBRequest; |
24 | | |
25 | | class SDBConnectionChild final |
26 | | : public PBackgroundSDBConnectionChild |
27 | | { |
28 | | friend class mozilla::ipc::BackgroundChildImpl; |
29 | | friend class SDBConnection; |
30 | | |
31 | | SDBConnection* mConnection; |
32 | | |
33 | | NS_DECL_OWNINGTHREAD |
34 | | |
35 | | public: |
36 | | void |
37 | | AssertIsOnOwningThread() const |
38 | 0 | { |
39 | 0 | NS_ASSERT_OWNINGTHREAD(SDBConnectionChild); |
40 | 0 | } |
41 | | |
42 | | private: |
43 | | // Only created by SDBConnection. |
44 | | explicit SDBConnectionChild(SDBConnection* aConnection); |
45 | | |
46 | | // Only destroyed by mozilla::ipc::BackgroundChildImpl. |
47 | | ~SDBConnectionChild(); |
48 | | |
49 | | void |
50 | | SendDeleteMeInternal(); |
51 | | |
52 | | // IPDL methods are only called by IPDL. |
53 | | virtual void |
54 | | ActorDestroy(ActorDestroyReason aWhy) override; |
55 | | |
56 | | virtual PBackgroundSDBRequestChild* |
57 | | AllocPBackgroundSDBRequestChild(const SDBRequestParams& aParams) override; |
58 | | |
59 | | virtual bool |
60 | | DeallocPBackgroundSDBRequestChild(PBackgroundSDBRequestChild* aActor) |
61 | | override; |
62 | | |
63 | | virtual mozilla::ipc::IPCResult |
64 | | RecvAllowToClose() override; |
65 | | |
66 | | virtual mozilla::ipc::IPCResult |
67 | | RecvClosed() override; |
68 | | }; |
69 | | |
70 | | class SDBRequestChild final |
71 | | : public PBackgroundSDBRequestChild |
72 | | { |
73 | | friend class SDBConnectionChild; |
74 | | friend class SDBConnection; |
75 | | |
76 | | RefPtr<SDBConnection> mConnection; |
77 | | RefPtr<SDBRequest> mRequest; |
78 | | |
79 | | public: |
80 | | void |
81 | | AssertIsOnOwningThread() const |
82 | | #ifdef DEBUG |
83 | | ; |
84 | | #else |
85 | 0 | { } |
86 | | #endif |
87 | | |
88 | | private: |
89 | | // Only created by SDBConnection. |
90 | | explicit SDBRequestChild(SDBRequest* aRequest); |
91 | | |
92 | | // Only destroyed by SDBConnectionChild. |
93 | | ~SDBRequestChild(); |
94 | | |
95 | | void |
96 | | HandleResponse(nsresult aResponse); |
97 | | |
98 | | void |
99 | | HandleResponse(); |
100 | | |
101 | | void |
102 | | HandleResponse(const nsCString& aResponse); |
103 | | |
104 | | // IPDL methods are only called by IPDL. |
105 | | virtual void |
106 | | ActorDestroy(ActorDestroyReason aWhy) override; |
107 | | |
108 | | virtual mozilla::ipc::IPCResult |
109 | | Recv__delete__(const SDBRequestResponse& aResponse) override; |
110 | | }; |
111 | | |
112 | | } // namespace dom |
113 | | } // namespace mozilla |
114 | | |
115 | | #endif // mozilla_dom_simpledb_ActorsChild_h |