Example #1
0
void
TextTrackManager::DispatchUpdateCueDisplay()
{
  if (!mUpdateCueDisplayDispatched && !mShutdown &&
      (mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
    WEBVTT_LOG("DispatchUpdateCueDisplay");
    NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::UpdateCueDisplay));
    mUpdateCueDisplayDispatched = true;
  }
}
Example #2
0
void
TextTrackManager::DispatchTimeMarchesOn()
{
  // Run the algorithm if no previous instance is still running, otherwise
  // enqueue the current playback position and whether only that changed
  // through its usual monotonic increase during normal playback; current
  // executing call upon completion will check queue for further 'work'.
  if (!mTimeMarchesOnDispatched && !mShutdown &&
      (mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
    WEBVTT_LOG("DispatchTimeMarchesOn");
    NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
    mTimeMarchesOnDispatched = true;
  }
}
void TextTrackManager::DispatchUpdateCueDisplay() {
  if (!mUpdateCueDisplayDispatched && !IsShutdown() &&
      mMediaElement->IsCurrentlyPlaying()) {
    WEBVTT_LOG("DispatchUpdateCueDisplay");
    nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
    if (win) {
      nsGlobalWindowInner::Cast(win)->Dispatch(
          TaskCategory::Other,
          NewRunnableMethod("dom::TextTrackManager::UpdateCueDisplay", this,
                            &TextTrackManager::UpdateCueDisplay));
      mUpdateCueDisplayDispatched = true;
    }
  }
}
void TextTrackManager::DispatchTimeMarchesOn() {
  // Run the algorithm if no previous instance is still running, otherwise
  // enqueue the current playback position and whether only that changed
  // through its usual monotonic increase during normal playback; current
  // executing call upon completion will check queue for further 'work'.
  if (!mTimeMarchesOnDispatched && !IsShutdown() &&
      mMediaElement->IsCurrentlyPlaying()) {
    WEBVTT_LOG("DispatchTimeMarchesOn");
    nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
    if (win) {
      nsGlobalWindowInner::Cast(win)->Dispatch(
          TaskCategory::Other,
          NewRunnableMethod("dom::TextTrackManager::TimeMarchesOn", this,
                            &TextTrackManager::TimeMarchesOn));
      mTimeMarchesOnDispatched = true;
    }
  }
}