WebrtcGlobalParent.h (1746B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef _WEBRTC_GLOBAL_PARENT_H_ 6 #define _WEBRTC_GLOBAL_PARENT_H_ 7 8 #include "mozilla/dom/PWebrtcGlobalParent.h" 9 #include "nsISupportsImpl.h" 10 11 namespace mozilla::dom { 12 13 class WebrtcParents; 14 15 class WebrtcGlobalParent : public PWebrtcGlobalParent { 16 friend class ContentParent; 17 friend class WebrtcGlobalInformation; 18 friend class WebrtcContentParents; 19 20 bool mShutdown; 21 nsTHashSet<nsString> mPcids; 22 23 MOZ_IMPLICIT WebrtcGlobalParent(); 24 25 static WebrtcGlobalParent* Alloc(); 26 static bool Dealloc(WebrtcGlobalParent* aActor); 27 28 virtual void ActorDestroy(ActorDestroyReason aWhy) override; 29 virtual mozilla::ipc::IPCResult Recv__delete__() override; 30 // Notification that a PeerConnection exists, and stats polling can begin 31 // if it hasn't already begun due to a previously created PeerConnection. 32 virtual mozilla::ipc::IPCResult RecvPeerConnectionCreated( 33 const nsAString& aPcId, const bool& aIsLongTermStatsDisabled) override; 34 // Notification that a PeerConnection no longer exists, and stats polling 35 // can end if there are no other PeerConnections. 36 virtual mozilla::ipc::IPCResult RecvPeerConnectionDestroyed( 37 const nsAString& aPcid) override; 38 // Ditto but we have final stats 39 virtual mozilla::ipc::IPCResult RecvPeerConnectionFinalStats( 40 const RTCStatsReportInternal& aFinalStats) override; 41 virtual ~WebrtcGlobalParent(); 42 43 public: 44 NS_INLINE_DECL_REFCOUNTING(WebrtcGlobalParent) 45 46 bool IsActive() { return !mShutdown; } 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif // _WEBRTC_GLOBAL_PARENT_H_