summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp b/chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
index f53e18cf44e..e96f2c89ff9 100644
--- a/chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
+++ b/chromium/third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.cpp
@@ -30,9 +30,9 @@
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
-#include "core/events/Event.h"
-#include "platform/audio/AudioUtilities.h"
+#include "modules/EventModules.h"
#include "modules/webaudio/AudioContext.h"
+#include "platform/audio/AudioUtilities.h"
#include <algorithm>
#include "wtf/MathExtras.h"
@@ -48,7 +48,6 @@ AudioScheduledSourceNode::AudioScheduledSourceNode(AudioContext* context, float
, m_startTime(0)
, m_endTime(UnknownTime)
, m_hasEndedListener(false)
- , m_stopCalled(false)
{
}
@@ -91,7 +90,6 @@ void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize,
if (m_playbackState == SCHEDULED_STATE) {
// Increment the active source count only if we're transitioning from SCHEDULED_STATE to PLAYING_STATE.
m_playbackState = PLAYING_STATE;
- context()->incrementActiveSourceCount();
}
quantumFrameOffset = startFrame > quantumStartFrame ? startFrame - quantumStartFrame : 0;
@@ -137,7 +135,6 @@ void AudioScheduledSourceNode::updateSchedulingInfo(size_t quantumFrameSize,
return;
}
-
void AudioScheduledSourceNode::start(double when, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
@@ -157,28 +154,23 @@ void AudioScheduledSourceNode::stop(double when, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
- if (m_stopCalled) {
- exceptionState.throwDOMException(
- InvalidStateError,
- "cannot call stop more than once.");
- } else if (m_playbackState == UNSCHEDULED_STATE) {
+ if (m_playbackState == UNSCHEDULED_STATE) {
exceptionState.throwDOMException(
InvalidStateError,
"cannot call stop without calling start first.");
} else {
- // This can only happen from the SCHEDULED_STATE or PLAYING_STATE. The UNSCHEDULED_STATE is
- // handled above, and the FINISHED_STATE is only reachable after stop() has been called, and
- // hence m_stopCalled is true. But that case is handled above.
+ // stop() can be called more than once, with the last call to stop taking effect, unless the
+ // source has already stopped due to earlier calls to stop. No exceptions are thrown in any
+ // case.
when = max(0.0, when);
m_endTime = when;
- m_stopCalled = true;
}
}
-void AudioScheduledSourceNode::setOnended(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld)
+void AudioScheduledSourceNode::setOnended(PassRefPtr<EventListener> listener)
{
m_hasEndedListener = listener;
- setAttributeEventListener(EventTypeNames::ended, listener, isolatedWorld);
+ setAttributeEventListener(EventTypeNames::ended, listener);
}
void AudioScheduledSourceNode::finish()
@@ -187,7 +179,6 @@ void AudioScheduledSourceNode::finish()
// Let the context dereference this AudioNode.
context()->notifyNodeFinishedProcessing(this);
m_playbackState = FINISHED_STATE;
- context()->decrementActiveSourceCount();
}
if (m_hasEndedListener) {
@@ -211,8 +202,8 @@ AudioScheduledSourceNode::NotifyEndedTask::NotifyEndedTask(PassRefPtr<AudioSched
void AudioScheduledSourceNode::NotifyEndedTask::notifyEnded()
{
- RefPtr<Event> event = Event::create(EventTypeNames::ended);
- event->setTarget(m_scheduledNode);
+ RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::ended);
+ event->setTarget(m_scheduledNode.get());
m_scheduledNode->dispatchEvent(event.get());
}