RTCIceTransport.h (1693B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=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_MEDIA_WEBRTC_JSAPI_RTCICETRANSPORT_H_ 8 #define MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCICETRANSPORT_H_ 9 10 #include "js/RootingAPI.h" 11 #include "mozilla/DOMEventTargetHelper.h" 12 #include "transport/transportlayer.h" 13 14 class nsPIDOMWindowInner; 15 16 namespace mozilla::dom { 17 18 enum class RTCIceTransportState : uint8_t; 19 enum class RTCIceGathererState : uint8_t; 20 21 class RTCIceTransport : public DOMEventTargetHelper { 22 public: 23 explicit RTCIceTransport(nsPIDOMWindowInner* aWindow); 24 25 // nsISupports 26 NS_DECL_ISUPPORTS_INHERITED 27 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCIceTransport, 28 DOMEventTargetHelper) 29 30 // webidl 31 JSObject* WrapObject(JSContext* aCx, 32 JS::Handle<JSObject*> aGivenProto) override; 33 IMPL_EVENT_HANDLER(statechange) 34 IMPL_EVENT_HANDLER(gatheringstatechange) 35 RTCIceTransportState State() const { return mState; } 36 RTCIceGathererState GatheringState() const { return mGatheringState; } 37 38 void SetState(RTCIceTransportState aState); 39 void SetGatheringState(RTCIceGathererState aState); 40 41 void FireStateChangeEvent(); 42 void FireGatheringStateChangeEvent(); 43 44 private: 45 virtual ~RTCIceTransport() = default; 46 47 RTCIceTransportState mState; 48 RTCIceGathererState mGatheringState; 49 }; 50 51 } // namespace mozilla::dom 52 #endif // MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCICETRANSPORT_H_