MediaSystemResourceManagerChild.h (1780B)
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 26 : public PMediaSystemResourceManagerChild { 27 friend class PMediaSystemResourceManagerChild; 28 29 public: 30 struct ResourceListener { 31 /* The resource is reserved and can be granted. 32 * The client can allocate the requested resource. 33 */ 34 virtual void resourceReserved() = 0; 35 /* The resource is not reserved any more. 36 * The client should release the resource as soon as possible if the 37 * resource is still being held. 38 */ 39 virtual void resourceCanceled() = 0; 40 }; 41 42 MediaSystemResourceManagerChild(); 43 virtual ~MediaSystemResourceManagerChild(); 44 45 void Destroy(); 46 47 void SetManager(MediaSystemResourceManager* aManager) { mManager = aManager; } 48 49 protected: 50 mozilla::ipc::IPCResult RecvResponse(const uint32_t& aId, 51 const bool& aSuccess); 52 53 private: 54 void ActorDestroy(ActorDestroyReason aActorDestroyReason) override; 55 56 bool mDestroyed; 57 MediaSystemResourceManager* mManager; 58 59 friend class mozilla::ipc::BackgroundChildImpl; 60 }; 61 62 } // namespace media 63 } // namespace mozilla 64 65 #endif