/src/mozilla-central/dom/media/webaudio/AudioProcessingEvent.cpp
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 | | #include "AudioProcessingEvent.h" |
8 | | #include "mozilla/dom/AudioProcessingEventBinding.h" |
9 | | #include "mozilla/dom/ScriptSettings.h" |
10 | | #include "AudioContext.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | NS_IMPL_CYCLE_COLLECTION_INHERITED(AudioProcessingEvent, Event, |
16 | | mInputBuffer, mOutputBuffer, mNode) |
17 | | |
18 | 0 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AudioProcessingEvent) |
19 | 0 | NS_INTERFACE_MAP_END_INHERITING(Event) |
20 | | |
21 | | NS_IMPL_ADDREF_INHERITED(AudioProcessingEvent, Event) |
22 | | NS_IMPL_RELEASE_INHERITED(AudioProcessingEvent, Event) |
23 | | |
24 | | AudioProcessingEvent::AudioProcessingEvent(ScriptProcessorNode* aOwner, |
25 | | nsPresContext* aPresContext, |
26 | | WidgetEvent* aEvent) |
27 | | : Event(aOwner, aPresContext, aEvent) |
28 | | , mPlaybackTime(0.0) |
29 | | , mNode(aOwner) |
30 | 0 | { |
31 | 0 | } |
32 | | |
33 | | AudioProcessingEvent::~AudioProcessingEvent() |
34 | 0 | { |
35 | 0 | } |
36 | | |
37 | | JSObject* |
38 | | AudioProcessingEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) |
39 | 0 | { |
40 | 0 | return AudioProcessingEvent_Binding::Wrap(aCx, this, aGivenProto); |
41 | 0 | } |
42 | | |
43 | | already_AddRefed<AudioBuffer> |
44 | | AudioProcessingEvent::LazilyCreateBuffer(uint32_t aNumberOfChannels, |
45 | | ErrorResult& aRv) |
46 | 0 | { |
47 | 0 | RefPtr<AudioBuffer> buffer = |
48 | 0 | AudioBuffer::Create(mNode->Context()->GetOwner(), aNumberOfChannels, |
49 | 0 | mNode->BufferSize(), |
50 | 0 | mNode->Context()->SampleRate(), aRv); |
51 | 0 | MOZ_ASSERT(buffer || aRv.ErrorCodeIs(NS_ERROR_OUT_OF_MEMORY)); |
52 | 0 | return buffer.forget(); |
53 | 0 | } |
54 | | |
55 | | } // namespace dom |
56 | | } // namespace mozilla |
57 | | |