/work/obj-fuzz/dist/include/mozilla/media/MediaParent.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 sw=2 ts=8 et ft=cpp : */ |
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_MediaParent_h |
8 | | #define mozilla_MediaParent_h |
9 | | |
10 | | #include "MediaChild.h" |
11 | | |
12 | | #include "mozilla/dom/ContentParent.h" |
13 | | #include "mozilla/media/PMediaParent.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace media { |
17 | | |
18 | | // media::Parent implements the chrome-process side of ipc for media::Child APIs |
19 | | // A same-process version may also be created to service non-e10s calls. |
20 | | |
21 | | class OriginKeyStore; |
22 | | |
23 | | class NonE10s |
24 | | { |
25 | | typedef mozilla::ipc::IProtocol::ActorDestroyReason |
26 | | ActorDestroyReason; |
27 | | public: |
28 | 0 | virtual ~NonE10s() {} |
29 | | protected: |
30 | | virtual mozilla::ipc::IPCResult |
31 | | RecvGetPrincipalKey(const uint32_t& aRequestId, |
32 | | const mozilla::ipc::PrincipalInfo& aPrincipalInfo, |
33 | | const bool& aPersist) = 0; |
34 | | virtual mozilla::ipc::IPCResult RecvSanitizeOriginKeys(const uint64_t& aSinceWhen, |
35 | | const bool& aOnlyPrivateBrowsing) = 0; |
36 | | virtual void |
37 | | ActorDestroy(ActorDestroyReason aWhy) = 0; |
38 | | |
39 | | bool SendGetPrincipalKeyResponse(const uint32_t& aRequestId, |
40 | | nsCString aKey); |
41 | | }; |
42 | | |
43 | | /** |
44 | | * Dummy class to avoid a templated class being passed to the refcounting macro |
45 | | * (see Bug 1334421 for what happens then) |
46 | | */ |
47 | | class RefCountedParent |
48 | | { |
49 | | public: |
50 | | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RefCountedParent) |
51 | | |
52 | | protected: |
53 | 0 | virtual ~RefCountedParent() {} |
54 | | }; |
55 | | |
56 | | // Super = PMediaParent or NonE10s |
57 | | |
58 | | template<class Super> |
59 | | class Parent : public RefCountedParent, public Super |
60 | | { |
61 | | typedef mozilla::ipc::IProtocol::ActorDestroyReason |
62 | | ActorDestroyReason; |
63 | | public: |
64 | | virtual mozilla::ipc::IPCResult |
65 | | RecvGetPrincipalKey(const uint32_t& aRequestId, |
66 | | const mozilla::ipc::PrincipalInfo& aPrincipalInfo, |
67 | | const bool& aPersist) override; |
68 | | virtual mozilla::ipc::IPCResult RecvSanitizeOriginKeys(const uint64_t& aSinceWhen, |
69 | | const bool& aOnlyPrivateBrowsing) override; |
70 | | virtual void ActorDestroy(ActorDestroyReason aWhy) override; |
71 | | |
72 | | Parent(); |
73 | | private: |
74 | | virtual ~Parent(); |
75 | | |
76 | | RefPtr<OriginKeyStore> mOriginKeyStore; |
77 | | bool mDestroyed; |
78 | | |
79 | | CoatCheck<Pledge<nsCString>> mOutstandingPledges; |
80 | | }; |
81 | | |
82 | | template<class Parent> |
83 | | mozilla::ipc::IPCResult IPCResult(Parent* aSelf, bool aSuccess); |
84 | | |
85 | | template<> |
86 | | inline mozilla::ipc::IPCResult IPCResult(Parent<PMediaParent>* aSelf, bool aSuccess) |
87 | 0 | { |
88 | 0 | return aSuccess ? IPC_OK() : IPC_FAIL_NO_REASON(aSelf); |
89 | 0 | } |
90 | | |
91 | | template<> |
92 | | inline mozilla::ipc::IPCResult IPCResult(Parent<NonE10s>* aSelf, bool aSuccess) |
93 | 0 | { |
94 | 0 | return IPC_OK(); |
95 | 0 | } |
96 | | |
97 | | PMediaParent* AllocPMediaParent(); |
98 | | bool DeallocPMediaParent(PMediaParent *aActor); |
99 | | |
100 | | } // namespace media |
101 | | } // namespace mozilla |
102 | | |
103 | | #endif // mozilla_MediaParent_h |