Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/WaveShaperNode.h
Line
Count
Source (jump to first uncovered line)
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 WaveShaperNode_h_
8
#define WaveShaperNode_h_
9
10
#include "AudioNode.h"
11
#include "mozilla/dom/WaveShaperNodeBinding.h"
12
#include "mozilla/dom/TypedArray.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
class AudioContext;
18
struct WaveShaperOptions;
19
20
class WaveShaperNode final : public AudioNode
21
{
22
public:
23
  static already_AddRefed<WaveShaperNode>
24
  Create(AudioContext& aAudioContext, const WaveShaperOptions& aOptions,
25
         ErrorResult& aRv);
26
27
  NS_DECL_ISUPPORTS_INHERITED
28
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(WaveShaperNode, AudioNode)
29
30
  static already_AddRefed<WaveShaperNode>
31
  Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
32
              const WaveShaperOptions& aOptions, ErrorResult& aRv)
33
0
  {
34
0
    return Create(aAudioContext, aOptions, aRv);
35
0
  }
36
37
  JSObject* WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
38
39
  void GetCurve(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval);
40
  void SetCurve(const Nullable<Float32Array>& aData, ErrorResult& aRv);
41
42
  OverSampleType Oversample() const
43
0
  {
44
0
    return mType;
45
0
  }
46
  void SetOversample(OverSampleType aType);
47
48
  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
49
  {
50
    // Possibly track in the future:
51
    // - mCurve
52
    return AudioNode::SizeOfExcludingThis(aMallocSizeOf);
53
  }
54
55
  const char* NodeType() const override
56
  {
57
    return "WaveShaperNode";
58
  }
59
60
  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
61
  {
62
    return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
63
  }
64
65
private:
66
  explicit WaveShaperNode(AudioContext *aContext);
67
  ~WaveShaperNode() = default;
68
69
  void SetCurveInternal(const nsTArray<float>& aCurve,
70
                        ErrorResult& aRv);
71
  void CleanCurveInternal();
72
73
  void SendCurveToStream();
74
75
  nsTArray<float> mCurve;
76
  OverSampleType mType;
77
};
78
79
} // namespace dom
80
} // namespace mozilla
81
82
#endif