/src/mozilla-central/dom/media/systemservices/MediaSystemResourceManagerChild.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #if !defined(MediaSystemResourceManagerChild_h_) |
7 | | #define MediaSystemResourceManagerChild_h_ |
8 | | |
9 | | #include "mozilla/media/PMediaSystemResourceManagerChild.h" |
10 | | #include "nsISupportsImpl.h" |
11 | | |
12 | | namespace mozilla { |
13 | | |
14 | | class MediaSystemResourceManager; |
15 | | |
16 | | namespace ipc { |
17 | | class BackgroundChildImpl; |
18 | | } // namespace ipc |
19 | | |
20 | | namespace media { |
21 | | |
22 | | /** |
23 | | * Handle MediaSystemResourceManager's IPC |
24 | | */ |
25 | | class MediaSystemResourceManagerChild final : public PMediaSystemResourceManagerChild |
26 | | { |
27 | | public: |
28 | | struct ResourceListener { |
29 | | /* The resource is reserved and can be granted. |
30 | | * The client can allocate the requested resource. |
31 | | */ |
32 | | virtual void resourceReserved() = 0; |
33 | | /* The resource is not reserved any more. |
34 | | * The client should release the resource as soon as possible if the |
35 | | * resource is still being held. |
36 | | */ |
37 | | virtual void resourceCanceled() = 0; |
38 | | }; |
39 | | |
40 | | MediaSystemResourceManagerChild(); |
41 | | virtual ~MediaSystemResourceManagerChild(); |
42 | | |
43 | | void Destroy(); |
44 | | |
45 | | void SetManager(MediaSystemResourceManager* aManager) |
46 | 0 | { |
47 | 0 | mManager = aManager; |
48 | 0 | } |
49 | | |
50 | | protected: |
51 | | mozilla::ipc::IPCResult RecvResponse(const uint32_t& aId, |
52 | | const bool& aSuccess) override; |
53 | | |
54 | | private: |
55 | | void ActorDestroy(ActorDestroyReason aActorDestroyReason) override; |
56 | | |
57 | | bool mDestroyed; |
58 | | MediaSystemResourceManager* mManager; |
59 | | |
60 | | friend class mozilla::ipc::BackgroundChildImpl; |
61 | | }; |
62 | | |
63 | | } // namespace media |
64 | | } // namespace mozilla |
65 | | |
66 | | #endif |