Changeset 269047 in webkit
- Timestamp:
- Oct 27, 2020, 10:09:34 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webaudio/resume-context-while-running-expected.txt (added)
-
LayoutTests/webaudio/resume-context-while-running.html (added)
-
LayoutTests/webaudio/suspend-context-while-suspended-expected.txt (added)
-
LayoutTests/webaudio/suspend-context-while-suspended.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioContext.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r269044 r269047 1 2020-10-27 Chris Dumez <cdumez@apple.com> 2 3 Calling AudioContext.suspend() / resume() while already suspended / running should resolve the promise right away 4 https://bugs.webkit.org/show_bug.cgi?id=218236 5 6 Reviewed by Sam Weinig. 7 8 Add layout test coverage. 9 10 * webaudio/resume-context-while-running-expected.txt: Added. 11 * webaudio/resume-context-while-running.html: Added. 12 * webaudio/suspend-context-while-suspended-expected.txt: Added. 13 * webaudio/suspend-context-while-suspended.html: Added. 14 1 15 2020-10-27 Ryan Haddad <ryanhaddad@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r269046 r269047 1 2020-10-27 Chris Dumez <cdumez@apple.com> 2 3 Calling AudioContext.suspend() / resume() while already suspended / running should resolve the promise right away 4 https://bugs.webkit.org/show_bug.cgi?id=218236 5 6 Reviewed by Sam Weinig. 7 8 Calling AudioContext.suspend() / resume() while already suspended / running should resolve the promise right 9 away. This is the behavior in the specification [1][2] and matches Blink / Gecko. 10 11 [1] https://www.w3.org/TR/webaudio/#dom-audiocontext-suspend 12 [2] https://www.w3.org/TR/webaudio/#dom-audiocontext-resume 13 14 Tests: webaudio/resume-context-while-running.html 15 webaudio/suspend-context-while-suspended.html 16 17 * Modules/webaudio/AudioContext.cpp: 18 (WebCore::AudioContext::suspendRendering): 19 (WebCore::AudioContext::resumeRendering): 20 1 21 2020-10-27 Chris Lord <clord@igalia.com> 2 22 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r269039 r269047 215 215 } 216 216 217 addReaction(State::Suspended, WTFMove(promise));218 217 m_wasSuspendedByScript = true; 219 218 220 if (!willPausePlayback()) 221 return; 222 223 lazyInitialize(); 224 225 destinationNode()->suspend([this, protectedThis = makeRef(*this)] { 219 if (!willPausePlayback()) { 220 addReaction(State::Suspended, WTFMove(promise)); 221 return; 222 } 223 224 lazyInitialize(); 225 226 destinationNode()->suspend([this, protectedThis = makeRef(*this), promise = WTFMove(promise)]() mutable { 226 227 setState(State::Suspended); 228 promise.resolve(); 227 229 }); 228 230 } … … 240 242 } 241 243 242 addReaction(State::Running, WTFMove(promise));243 244 m_wasSuspendedByScript = false; 244 245 245 if (!willBeginPlayback()) 246 return; 247 248 lazyInitialize(); 249 250 destinationNode()->resume([this, protectedThis = makeRef(*this)] { 246 if (!willBeginPlayback()) { 247 addReaction(State::Running, WTFMove(promise)); 248 return; 249 } 250 251 lazyInitialize(); 252 253 destinationNode()->resume([this, protectedThis = makeRef(*this), promise = WTFMove(promise)]() mutable { 251 254 // Since we update the state asynchronously, we may have been interrupted after the 252 255 // call to resume() and before this lambda runs. In this case, we don't want to … … 254 257 bool interrupted = m_mediaSession->state() == PlatformMediaSession::Interrupted; 255 258 setState(interrupted ? State::Interrupted : State::Running); 259 if (interrupted) 260 addReaction(State::Running, WTFMove(promise)); 261 else 262 promise.resolve(); 256 263 }); 257 264 }
Note:
See TracChangeset
for help on using the changeset viewer.