• Etienne Bergeron's avatar
    Fix Pause/Resume race issue skipping enqueued utterance · a2068243
    Etienne Bergeron authored
    This CL is fixing an inconsistent state that can happen in
    the TtsPlatformImplWin class.
    
    TtsPlatformImplWin has a background worker
    TtsPlatformImplBackgroundWorkerthat processes
    asynchronously tasks and sending back notifications.
    
    There was a corner case where Pause is called
      TtsPlatformImplWin::Pause(...)
    and there was a notification in transit to notify the
    completion of the current spoke utterance.
    
    This was leading to that state:
      TtsPlatformImplWin::is_speaking_ = false
      TtsPlatformImplWin::paused_ = true
    
    This CL is changing the TtsPlatformImplWin class to handle
    properly the notifications sent back by the worker. If the
    notifications clear/stop the utterance and the current
    state is paused_, a Resume(...) is performed to ensure
    a valid state.
    
    R=dmazzoni@chromium.org
    
    Bug: 1167103
    Change-Id: I719dca37e08094afc214d469432c7e2541d155f2
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640753Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
    Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#846161}
    a2068243
tts_win.cc 21.1 KB