/work/obj-fuzz/dist/include/mozilla/dom/PeriodicWave.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 PeriodicWave_h_ |
8 | | #define PeriodicWave_h_ |
9 | | |
10 | | #include "nsWrapperCache.h" |
11 | | #include "nsCycleCollectionParticipant.h" |
12 | | #include "mozilla/Attributes.h" |
13 | | #include "AudioContext.h" |
14 | | #include "AudioNodeEngine.h" |
15 | | |
16 | | namespace mozilla { |
17 | | |
18 | | namespace dom { |
19 | | |
20 | | class AudioContext; |
21 | | struct PeriodicWaveOptions; |
22 | | |
23 | | class PeriodicWave final : public nsWrapperCache |
24 | | { |
25 | | public: |
26 | | PeriodicWave(AudioContext* aContext, |
27 | | const float* aRealData, |
28 | | const float* aImagData, |
29 | | const uint32_t aLength, |
30 | | const bool aDisableNormalization, |
31 | | ErrorResult& aRv); |
32 | | |
33 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PeriodicWave) |
34 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PeriodicWave) |
35 | | |
36 | | static already_AddRefed<PeriodicWave> |
37 | | Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext, |
38 | | const PeriodicWaveOptions& aOptions, ErrorResult& aRv); |
39 | | |
40 | | AudioContext* GetParentObject() const |
41 | 0 | { |
42 | 0 | return mContext; |
43 | 0 | } |
44 | | |
45 | | JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
46 | | |
47 | | uint32_t DataLength() const |
48 | 0 | { |
49 | 0 | return mCoefficients.mDuration; |
50 | 0 | } |
51 | | |
52 | | bool DisableNormalization() const |
53 | 0 | { |
54 | 0 | return mDisableNormalization; |
55 | 0 | } |
56 | | |
57 | | const AudioChunk& GetThreadSharedBuffer() const |
58 | 0 | { |
59 | 0 | return mCoefficients; |
60 | 0 | } |
61 | | |
62 | | size_t SizeOfExcludingThisIfNotShared(MallocSizeOf aMallocSizeOf) const; |
63 | | size_t SizeOfIncludingThisIfNotShared(MallocSizeOf aMallocSizeOf) const; |
64 | | |
65 | | private: |
66 | 0 | ~PeriodicWave() = default; |
67 | | |
68 | | AudioChunk mCoefficients; |
69 | | RefPtr<AudioContext> mContext; |
70 | | bool mDisableNormalization; |
71 | | }; |
72 | | |
73 | | } // namespace dom |
74 | | } // namespace mozilla |
75 | | |
76 | | #endif |