OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/dom/CrossThreadTask.h" | 32 #include "core/dom/CrossThreadTask.h" |
33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
34 #include "modules/EventModules.h" | 34 #include "modules/EventModules.h" |
35 #include "modules/webaudio/AudioContext.h" | 35 #include "modules/webaudio/AudioContext.h" |
36 #include "platform/audio/AudioUtilities.h" | 36 #include "platform/audio/AudioUtilities.h" |
37 #include "wtf/MathExtras.h" | 37 #include "wtf/MathExtras.h" |
38 #include <algorithm> | 38 #include <algorithm> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 #if !ENABLE(OILPAN) | |
43 // We need a dedicated specialization for AudioScheduledSourceNode because it | |
44 // doesn't inherit from RefCounted. | |
45 template<> struct CrossThreadCopierBase<false, false, false, PassRefPtr<AudioSch
eduledSourceNode> > : public CrossThreadCopierPassThrough<PassRefPtr<AudioSchedu
ledSourceNode> > { | |
46 }; | |
47 #endif | |
48 | |
49 const double AudioScheduledSourceNode::UnknownTime = -1; | 42 const double AudioScheduledSourceNode::UnknownTime = -1; |
50 | 43 |
51 AudioScheduledSourceNode::AudioScheduledSourceNode(AudioContext* context, float
sampleRate) | 44 AudioScheduledSourceNode::AudioScheduledSourceNode(AudioContext* context, float
sampleRate) |
52 : AudioSourceNode(context, sampleRate) | 45 : AudioSourceNode(context, sampleRate) |
53 , m_playbackState(UNSCHEDULED_STATE) | 46 , m_playbackState(UNSCHEDULED_STATE) |
54 , m_startTime(0) | 47 , m_startTime(0) |
55 , m_endTime(UnknownTime) | 48 , m_endTime(UnknownTime) |
56 , m_hasEndedListener(false) | 49 , m_hasEndedListener(false) |
57 { | 50 { |
58 } | 51 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 174 |
182 void AudioScheduledSourceNode::finish() | 175 void AudioScheduledSourceNode::finish() |
183 { | 176 { |
184 if (m_playbackState != FINISHED_STATE) { | 177 if (m_playbackState != FINISHED_STATE) { |
185 // Let the context dereference this AudioNode. | 178 // Let the context dereference this AudioNode. |
186 context()->notifyNodeFinishedProcessing(this); | 179 context()->notifyNodeFinishedProcessing(this); |
187 m_playbackState = FINISHED_STATE; | 180 m_playbackState = FINISHED_STATE; |
188 } | 181 } |
189 | 182 |
190 if (m_hasEndedListener && context()->executionContext()) { | 183 if (m_hasEndedListener && context()->executionContext()) { |
191 context()->executionContext()->postTask(createCrossThreadTask(&AudioSche
duledSourceNode::notifyEnded, PassRefPtrWillBeRawPtr<AudioScheduledSourceNode>(t
his))); | 184 context()->executionContext()->postTask(createCrossThreadTask(&AudioSche
duledSourceNode::notifyEnded, this)); |
192 } | 185 } |
193 } | 186 } |
194 | 187 |
195 void AudioScheduledSourceNode::notifyEnded() | 188 void AudioScheduledSourceNode::notifyEnded() |
196 { | 189 { |
197 dispatchEvent(Event::create(EventTypeNames::ended)); | 190 dispatchEvent(Event::create(EventTypeNames::ended)); |
198 } | 191 } |
199 | 192 |
200 } // namespace blink | 193 } // namespace blink |
201 | 194 |
202 #endif // ENABLE(WEB_AUDIO) | 195 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |