namespace blink {
-#if !ENABLE(OILPAN)
-// We need a dedicated specialization for AudioScheduledSourceNode because it
-// doesn't inherit from RefCounted.
-template<> struct CrossThreadCopierBase<false, false, false, PassRefPtr<AudioScheduledSourceNode> > : public CrossThreadCopierPassThrough<PassRefPtr<AudioScheduledSourceNode> > {
-};
-#endif
-
const double AudioScheduledSourceNode::UnknownTime = -1;
AudioScheduledSourceNode::AudioScheduledSourceNode(AudioContext* context, float sampleRate)
return;
}
+ if (!std::isfinite(when) || (when < 0)) {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "Start time must be a finite non-negative number: " + String::number(when));
+ return;
+ }
+
m_startTime = when;
m_playbackState = SCHEDULED_STATE;
}
exceptionState.throwDOMException(
InvalidStateError,
"cannot call stop without calling start first.");
- } else {
- // 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 = std::max(0.0, when);
- m_endTime = when;
+ return;
}
+
+ if (!std::isfinite(when) || (when < 0)) {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "Stop time must be a finite non-negative number: " + String::number(when));
+ return;
+ }
+
+ // 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 = std::max(0.0, when);
+ m_endTime = when;
}
void AudioScheduledSourceNode::setOnended(PassRefPtr<EventListener> listener)
}
if (m_hasEndedListener && context()->executionContext()) {
- context()->executionContext()->postTask(createCrossThreadTask(&AudioScheduledSourceNode::notifyEnded, PassRefPtrWillBeRawPtr<AudioScheduledSourceNode>(this)));
+ context()->executionContext()->postTask(createCrossThreadTask(&AudioScheduledSourceNode::notifyEnded, this));
}
}