summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/jsapi/RTCRtpScriptTransform.h
blob: 362c59b761614c6eee390fdab754f0bb9d534b18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#ifndef MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_
#define MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_

#include "nsISupports.h"
#include "nsWrapperCache.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Maybe.h"
#include "js/RootingAPI.h"
#include "nsTArray.h"

class nsPIDOMWindowInner;

namespace mozilla {
class FrameTransformerProxy;
class ErrorResult;

namespace dom {
class Worker;
class GlobalObject;
template <typename T>
class Sequence;
template <typename T>
class Optional;

class RTCRtpScriptTransform : public nsISupports, public nsWrapperCache {
 public:
  static already_AddRefed<RTCRtpScriptTransform> Constructor(
      const GlobalObject& aGlobal, Worker& aWorker,
      JS::Handle<JS::Value> aOptions,
      const Optional<Sequence<JSObject*>>& aTransfer, ErrorResult& aRv);

  explicit RTCRtpScriptTransform(nsPIDOMWindowInner* aWindow);

  // nsISupports
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(RTCRtpScriptTransform)

  JSObject* WrapObject(JSContext* aCx,
                       JS::Handle<JSObject*> aGivenProto) override;

  nsPIDOMWindowInner* GetParentObject() const { return mWindow; }

  FrameTransformerProxy& GetProxy() { return *mProxy; }

  bool IsClaimed() const { return mClaimed; }
  void SetClaimed() { mClaimed = true; }

 private:
  virtual ~RTCRtpScriptTransform();
  RefPtr<nsPIDOMWindowInner> mWindow;
  RefPtr<FrameTransformerProxy> mProxy;
  bool mClaimed = false;
};

}  // namespace dom
}  // namespace mozilla
#endif  // MOZILLA_DOM_MEDIA_WEBRTC_JSAPI_RTCRTPSCRIPTTRANSFORM_H_