void
nsSpeechTask::Cancel()
{
  MOZ_ASSERT(XRE_IsParentProcess());

  LOG(LogLevel::Debug, ("nsSpeechTask::Cancel"));

  if (mCallback) {
    DebugOnly<nsresult> rv = mCallback->OnCancel();
    NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
                         "Unable to call onCancel() callback");
  }

  if (mStream) {
    mStream->Suspend();
  }

  if (!mInited) {
    mPreCanceled = true;
  }

  if (!mIndirectAudio) {
    DispatchEndInner(GetCurrentTime(), GetCurrentCharOffset());
  }
}
Beispiel #2
0
NS_IMETHODIMP
nsSpeechTask::DispatchEnd(float aElapsedTime, uint32_t aCharIndex)
{
  if (!mIndirectAudio) {
    NS_WARNING("Can't call DispatchEnd() from a direct audio speech service");
    return NS_ERROR_FAILURE;
  }

  return DispatchEndInner(aElapsedTime, aCharIndex);
}
Beispiel #3
0
void
nsSpeechTask::ForceEnd()
{
  if (mStream) {
    mStream->Suspend();
  }

  if (!mInited) {
    mPreCanceled = true;
  }

  DispatchEndInner(GetCurrentTime(), GetCurrentCharOffset());
}
Beispiel #4
0
void
nsSpeechTask::ForceEnd()
{
  if (mStream) {
    mStream->ChangeExplicitBlockerCount(1);
  }

  if (!mInited) {
    mPreCanceled = true;
  }

  DispatchEndInner(GetCurrentTime(), GetCurrentCharOffset());
}