/work/obj-fuzz/dist/include/mozilla/dom/ContentBridgeParent.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_ContentBridgeParent_h |
8 | | #define mozilla_dom_ContentBridgeParent_h |
9 | | |
10 | | #include "mozilla/dom/PContentBridgeParent.h" |
11 | | #include "mozilla/dom/nsIContentParent.h" |
12 | | #include "mozilla/dom/ipc/IdType.h" |
13 | | #include "nsIObserver.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | class ContentBridgeParent : public PContentBridgeParent |
19 | | , public nsIContentParent |
20 | | , public nsIObserver |
21 | | { |
22 | | public: |
23 | | explicit ContentBridgeParent(); |
24 | | |
25 | | NS_DECL_ISUPPORTS |
26 | | NS_DECL_NSIOBSERVER |
27 | | |
28 | | virtual void ActorDestroy(ActorDestroyReason aWhy) override; |
29 | | void DeferredDestroy(); |
30 | 0 | virtual bool IsContentBridgeParent() const override { return true; } |
31 | | void NotifyTabDestroyed(); |
32 | | |
33 | | static ContentBridgeParent* |
34 | | Create(Endpoint<PContentBridgeParent>&& aEndpoint); |
35 | | |
36 | | virtual PBrowserParent* |
37 | | SendPBrowserConstructor(PBrowserParent* aActor, |
38 | | const TabId& aTabId, |
39 | | const TabId& aSameTabGroupAs, |
40 | | const IPCTabContext& aContext, |
41 | | const uint32_t& aChromeFlags, |
42 | | const ContentParentId& aCpID, |
43 | | const bool& aIsForBrowser) override; |
44 | | |
45 | | virtual PFileDescriptorSetParent* |
46 | | SendPFileDescriptorSetConstructor(const FileDescriptor&) override; |
47 | | |
48 | | FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeParent) |
49 | | |
50 | | jsipc::CPOWManager* GetCPOWManager() override; |
51 | | |
52 | | virtual ContentParentId ChildID() const override |
53 | 0 | { |
54 | 0 | return mChildID; |
55 | 0 | } |
56 | | virtual bool IsForBrowser() const override |
57 | 0 | { |
58 | 0 | return mIsForBrowser; |
59 | 0 | } |
60 | | virtual int32_t Pid() const override |
61 | 0 | { |
62 | 0 | // XXX: do we need this for ContentBridgeParent? |
63 | 0 | return -1; |
64 | 0 | } |
65 | | virtual bool IsForJSPlugin() const override |
66 | 0 | { |
67 | 0 | return mIsForJSPlugin; |
68 | 0 | } |
69 | | |
70 | | |
71 | | virtual mozilla::ipc::PParentToChildStreamParent* |
72 | | SendPParentToChildStreamConstructor(mozilla::ipc::PParentToChildStreamParent*) override; |
73 | | |
74 | | virtual bool SendActivate(PBrowserParent* aTab) override |
75 | 0 | { |
76 | 0 | return PContentBridgeParent::SendActivate(aTab); |
77 | 0 | } |
78 | | |
79 | | virtual bool SendDeactivate(PBrowserParent* aTab) override |
80 | 0 | { |
81 | 0 | return PContentBridgeParent::SendDeactivate(aTab); |
82 | 0 | } |
83 | | |
84 | | protected: |
85 | | virtual ~ContentBridgeParent(); |
86 | | |
87 | | void SetChildID(ContentParentId aId) |
88 | 0 | { |
89 | 0 | mChildID = aId; |
90 | 0 | } |
91 | | |
92 | | void SetIsForBrowser(bool aIsForBrowser) |
93 | 0 | { |
94 | 0 | mIsForBrowser = aIsForBrowser; |
95 | 0 | } |
96 | | void SetIsForJSPlugin(bool aIsForJSPlugin) |
97 | 0 | { |
98 | 0 | mIsForJSPlugin = aIsForJSPlugin; |
99 | 0 | } |
100 | | |
101 | | void Close() |
102 | 0 | { |
103 | 0 | // Trick NewRunnableMethod |
104 | 0 | PContentBridgeParent::Close(); |
105 | 0 | } |
106 | | |
107 | | protected: |
108 | | virtual mozilla::ipc::IPCResult |
109 | | RecvSyncMessage(const nsString& aMsg, |
110 | | const ClonedMessageData& aData, |
111 | | InfallibleTArray<jsipc::CpowEntry>&& aCpows, |
112 | | const IPC::Principal& aPrincipal, |
113 | | nsTArray<StructuredCloneData>* aRetvals) override; |
114 | | |
115 | | virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg, |
116 | | InfallibleTArray<jsipc::CpowEntry>&& aCpows, |
117 | | const IPC::Principal& aPrincipal, |
118 | | const ClonedMessageData& aData) override; |
119 | | |
120 | | virtual jsipc::PJavaScriptParent* AllocPJavaScriptParent() override; |
121 | | |
122 | | virtual bool |
123 | | DeallocPJavaScriptParent(jsipc::PJavaScriptParent*) override; |
124 | | |
125 | | virtual PBrowserParent* |
126 | | AllocPBrowserParent(const TabId& aTabId, |
127 | | const TabId& aSameTabGroupAs, |
128 | | const IPCTabContext &aContext, |
129 | | const uint32_t& aChromeFlags, |
130 | | const ContentParentId& aCpID, |
131 | | const bool& aIsForBrowser) override; |
132 | | |
133 | | virtual bool DeallocPBrowserParent(PBrowserParent*) override; |
134 | | |
135 | | virtual mozilla::ipc::IPCResult |
136 | | RecvPBrowserConstructor(PBrowserParent* actor, |
137 | | const TabId& tabId, |
138 | | const TabId& sameTabGroupAs, |
139 | | const IPCTabContext& context, |
140 | | const uint32_t& chromeFlags, |
141 | | const ContentParentId& cpId, |
142 | | const bool& isForBrowser) override; |
143 | | |
144 | | virtual PIPCBlobInputStreamParent* |
145 | | SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor, |
146 | | const nsID& aID, |
147 | | const uint64_t& aSize) override; |
148 | | |
149 | | virtual PIPCBlobInputStreamParent* |
150 | | AllocPIPCBlobInputStreamParent(const nsID& aID, |
151 | | const uint64_t& aSize) override; |
152 | | |
153 | | virtual bool |
154 | | DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent*) override; |
155 | | |
156 | | virtual PChildToParentStreamParent* AllocPChildToParentStreamParent() override; |
157 | | |
158 | | virtual bool |
159 | | DeallocPChildToParentStreamParent(PChildToParentStreamParent* aActor) override; |
160 | | |
161 | | virtual mozilla::ipc::PParentToChildStreamParent* |
162 | | AllocPParentToChildStreamParent() override; |
163 | | |
164 | | virtual bool |
165 | | DeallocPParentToChildStreamParent(mozilla::ipc::PParentToChildStreamParent* aActor) override; |
166 | | |
167 | | virtual PFileDescriptorSetParent* |
168 | | AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor&) override; |
169 | | |
170 | | virtual bool |
171 | | DeallocPFileDescriptorSetParent(PFileDescriptorSetParent*) override; |
172 | | |
173 | | DISALLOW_EVIL_CONSTRUCTORS(ContentBridgeParent); |
174 | | |
175 | | protected: // members |
176 | | RefPtr<ContentBridgeParent> mSelfRef; |
177 | | ContentParentId mChildID; |
178 | | bool mIsForBrowser; |
179 | | bool mIsForJSPlugin; |
180 | | |
181 | | private: |
182 | | friend class ContentParent; |
183 | | }; |
184 | | |
185 | | } // namespace dom |
186 | | } // namespace mozilla |
187 | | |
188 | | #endif // mozilla_dom_ContentBridgeParent_h |