Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioProcessingEvent.cpp

Issue 2491653002: Add constructors for WebAudio events (Closed)
Patch Set: Add links to spec. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #include "modules/webaudio/AudioProcessingEvent.h" 26 #include "modules/webaudio/AudioProcessingEvent.h"
27 27
28 #include "modules/webaudio/AudioProcessingEventInit.h"
29
28 namespace blink { 30 namespace blink {
29 31
30 AudioProcessingEvent* AudioProcessingEvent::create() { 32 AudioProcessingEvent* AudioProcessingEvent::create() {
31 return new AudioProcessingEvent; 33 return new AudioProcessingEvent;
32 } 34 }
33 35
34 AudioProcessingEvent* AudioProcessingEvent::create(AudioBuffer* inputBuffer, 36 AudioProcessingEvent* AudioProcessingEvent::create(AudioBuffer* inputBuffer,
35 AudioBuffer* outputBuffer, 37 AudioBuffer* outputBuffer,
36 double playbackTime) { 38 double playbackTime) {
37 return new AudioProcessingEvent(inputBuffer, outputBuffer, playbackTime); 39 return new AudioProcessingEvent(inputBuffer, outputBuffer, playbackTime);
38 } 40 }
39 41
42 AudioProcessingEvent* AudioProcessingEvent::create(
43 const AtomicString& eventType,
foolip 2016/11/15 19:53:33 Suggest type/initializer here too, like below and
Raymond Toy 2016/11/15 22:07:42 Done.
44 const AudioProcessingEventInit& eventInit) {
45 return new AudioProcessingEvent(eventType, eventInit);
46 }
47
40 AudioProcessingEvent::AudioProcessingEvent() {} 48 AudioProcessingEvent::AudioProcessingEvent() {}
41 49
42 AudioProcessingEvent::AudioProcessingEvent(AudioBuffer* inputBuffer, 50 AudioProcessingEvent::AudioProcessingEvent(AudioBuffer* inputBuffer,
43 AudioBuffer* outputBuffer, 51 AudioBuffer* outputBuffer,
44 double playbackTime) 52 double playbackTime)
45 : Event(EventTypeNames::audioprocess, true, false), 53 : Event(EventTypeNames::audioprocess, true, false),
46 m_inputBuffer(inputBuffer), 54 m_inputBuffer(inputBuffer),
47 m_outputBuffer(outputBuffer), 55 m_outputBuffer(outputBuffer),
48 m_playbackTime(playbackTime) {} 56 m_playbackTime(playbackTime) {}
49 57
58 AudioProcessingEvent::AudioProcessingEvent(
59 const AtomicString& type,
60 const AudioProcessingEventInit& initializer)
61 : Event(type, initializer) {
62 m_inputBuffer = initializer.inputBuffer();
63 m_outputBuffer = initializer.outputBuffer();
64 m_playbackTime = initializer.playbackTime();
65 }
66
50 AudioProcessingEvent::~AudioProcessingEvent() {} 67 AudioProcessingEvent::~AudioProcessingEvent() {}
51 68
52 const AtomicString& AudioProcessingEvent::interfaceName() const { 69 const AtomicString& AudioProcessingEvent::interfaceName() const {
53 return EventNames::AudioProcessingEvent; 70 return EventNames::AudioProcessingEvent;
54 } 71 }
55 72
56 DEFINE_TRACE(AudioProcessingEvent) { 73 DEFINE_TRACE(AudioProcessingEvent) {
57 visitor->trace(m_inputBuffer); 74 visitor->trace(m_inputBuffer);
58 visitor->trace(m_outputBuffer); 75 visitor->trace(m_outputBuffer);
59 Event::trace(visitor); 76 Event::trace(visitor);
60 } 77 }
61 78
62 } // namespace blink 79 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698