|
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 #include "nsAutoPtr.h" |
|
16 |
|
17 namespace mozilla { |
|
18 |
|
19 namespace dom { |
|
20 |
|
21 class PeriodicWave MOZ_FINAL : public nsWrapperCache |
|
22 { |
|
23 public: |
|
24 PeriodicWave(AudioContext* aContext, |
|
25 const float* aRealData, |
|
26 const float* aImagData, |
|
27 const uint32_t aLength, |
|
28 ErrorResult& aRv); |
|
29 |
|
30 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PeriodicWave) |
|
31 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PeriodicWave) |
|
32 |
|
33 AudioContext* GetParentObject() const |
|
34 { |
|
35 return mContext; |
|
36 } |
|
37 |
|
38 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
39 |
|
40 uint32_t DataLength() const |
|
41 { |
|
42 return mLength; |
|
43 } |
|
44 |
|
45 ThreadSharedFloatArrayBufferList* GetThreadSharedBuffer() const |
|
46 { |
|
47 return mCoefficients; |
|
48 } |
|
49 |
|
50 size_t SizeOfExcludingThisIfNotShared(MallocSizeOf aMallocSizeOf) const; |
|
51 |
|
52 private: |
|
53 nsRefPtr<AudioContext> mContext; |
|
54 nsRefPtr<ThreadSharedFloatArrayBufferList> mCoefficients; |
|
55 uint32_t mLength; |
|
56 }; |
|
57 |
|
58 } |
|
59 } |
|
60 |
|
61 #endif |