RTCRtpScriptTransform.h (1886B)
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 5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ 6 7 #ifndef MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_ 8 #define MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_ 9 10 #include "js/RootingAPI.h" 11 #include "mozilla/RefPtr.h" 12 #include "nsISupports.h" 13 #include "nsTArray.h" 14 #include "nsWrapperCache.h" 15 16 class nsPIDOMWindowInner; 17 18 namespace mozilla { 19 class FrameTransformerProxy; 20 class ErrorResult; 21 22 namespace dom { 23 class Worker; 24 class GlobalObject; 25 template <typename T> 26 class Sequence; 27 template <typename T> 28 class Optional; 29 30 class RTCRtpScriptTransform : public nsISupports, public nsWrapperCache { 31 public: 32 static already_AddRefed<RTCRtpScriptTransform> Constructor( 33 const GlobalObject& aGlobal, Worker& aWorker, 34 JS::Handle<JS::Value> aOptions, 35 const Optional<Sequence<JSObject*>>& aTransfer, ErrorResult& aRv); 36 37 explicit RTCRtpScriptTransform(nsPIDOMWindowInner* aWindow); 38 39 // nsISupports 40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 41 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(RTCRtpScriptTransform) 42 43 JSObject* WrapObject(JSContext* aCx, 44 JS::Handle<JSObject*> aGivenProto) override; 45 46 nsPIDOMWindowInner* GetParentObject() const { return mWindow; } 47 48 FrameTransformerProxy& GetProxy() { return *mProxy; } 49 50 bool IsClaimed() const { return mClaimed; } 51 void SetClaimed() { mClaimed = true; } 52 53 private: 54 virtual ~RTCRtpScriptTransform(); 55 RefPtr<nsPIDOMWindowInner> mWindow; 56 RefPtr<FrameTransformerProxy> mProxy; 57 bool mClaimed = false; 58 }; 59 60 } // namespace dom 61 } // namespace mozilla 62 #endif // MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_