Implement suspend() and resume() for OfflineAudioContext
NOTE: This is the second attempt of https://crrev.com/1140723003/
TODO:
1. Edit core/frame/UseCounter.h accordingly.
2. Add UMA metric in OfflineAudioContext.idl.
Adds suspend() and resume() feature in OfflineAudioContext to support the
synchronous graph manipulation with the render block precision (k-rate) in the
non-realtime audio rendering.
The benefit of being able to suspend/resume the context with the render block
precision is:
1) The audio graph can be modified in a time-accurate way, independent of the
hardware. Without this, setTimeout, completion events, or state change events
are needed to manipulate the graph, and the results depend on when the events
are fired and on how fast the hardware is.
2) Makes an OfflineAudioContext more symmetrical to the AudioContext, which
already supports suspend/resume. (There are minor difference required by the
difference between offline and online contexts.)
This feature also can be used in Blink layout tests to verify the behavior of
audio rendering. With this feature in the implementation, several flaky web
audio layout tests can be fixed.
http://webaudio.github.io/web-audio-api/#the-offlineaudiocontext-interface
https://github.com/WebAudio/web-audio-api/issues/302#issuecomment-106101885
BUG=497933, 545686
TEST=
webaudio/offlineaudiocontext-suspend-resume-basic.html
webaudio/offlineaudiocontext-suspend-resume-eventhandler.html
webaudio/offlineaudiocontext-suspend-resume-graph-manipulation.html
webaudio/offlineaudiocontext-suspend-resume-promise.html
webaudio/offlineaudiocontext-suspend-resume-sequence.html
Review URL: https://codereview.chromium.org/1405413004
Cr-Commit-Position: refs/heads/master@{#361367}
27 files changed