tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ConstantSourceNode.h (1855B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      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 http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef ConstantSourceNode_h_
      8 #define ConstantSourceNode_h_
      9 
     10 #include "AudioParam.h"
     11 #include "AudioScheduledSourceNode.h"
     12 #include "mozilla/dom/ConstantSourceNodeBinding.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class AudioContext;
     17 
     18 class ConstantSourceNode final : public AudioScheduledSourceNode,
     19                                 public MainThreadMediaTrackListener {
     20 public:
     21  explicit ConstantSourceNode(AudioContext* aContext);
     22 
     23  NS_DECL_ISUPPORTS_INHERITED
     24  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ConstantSourceNode,
     25                                           AudioScheduledSourceNode)
     26 
     27  JSObject* WrapObject(JSContext* aCx,
     28                       JS::Handle<JSObject*> aGivenProto) override;
     29 
     30  static already_AddRefed<ConstantSourceNode> Constructor(
     31      const GlobalObject& aGlobal, AudioContext& aContext,
     32      const ConstantSourceOptions& aOptions);
     33 
     34  void DestroyMediaTrack() override;
     35 
     36  uint16_t NumberOfInputs() const final { return 0; }
     37 
     38  AudioParam* Offset() const { return mOffset; }
     39 
     40  void Start(double aWhen, ErrorResult& rv) override;
     41  void Stop(double aWhen, ErrorResult& rv) override;
     42 
     43  void NotifyMainThreadTrackEnded() override;
     44 
     45  const char* NodeType() const override { return "ConstantSourceNode"; }
     46 
     47  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
     48  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
     49 
     50 protected:
     51  virtual ~ConstantSourceNode();
     52 
     53 private:
     54  RefPtr<AudioParam> mOffset;
     55  bool mStartCalled;
     56 };
     57 
     58 }  // namespace mozilla::dom
     59 
     60 #endif