Commit e516f97c authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Do PerformCleanupOnMainThread() when OfflineAudioContext rendering ends

Currently OfflineAudioContext does not do the clean up when rendering
is finished. This CL adds the clean up process when `oncomplete` event
is fired.

with --repeat-each=50 option.

Bug: 856317
Test: webaudio/Analyser/realtimeanalyser-float-data.html passes
Change-Id: Ia0556f666bc49ddb92666beab4171cfcf5c385ba
Reviewed-on: https://chromium-review.googlesource.com/1237384
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594049}
parent 1d9f5a62
......@@ -353,6 +353,16 @@ class MODULES_EXPORT BaseAudioContext
const String& Uuid() const { return uuid_; }
// The audio thread relies on the main thread to perform some operations
// over the objects that it owns and controls; |ScheduleMainThreadCleanup()|
// posts the task to initiate those.
void ScheduleMainThreadCleanup();
// Handles promise resolving, stopping and finishing up of audio source nodes
// etc. Actions that should happen, but can happen asynchronously to the
// audio thread making rendering progress.
void PerformCleanupOnMainThread();
private:
friend class AudioContextAutoplayTest;
......@@ -392,18 +402,6 @@ class MODULES_EXPORT BaseAudioContext
// these Promises.
void ResolvePromisesForUnpause();
// The audio thread relies on the main thread to perform some operations
// over the objects that it owns and controls; |ScheduleMainThreadCleanup()|
// posts the task to initiate those.
//
// That is, we combine all those sub-tasks into one task action for
// convenience and performance, |PerformCleanupOnMainThread()|. It handles
// promise resolving, stopping and finishing up of audio source nodes etc.
// Actions that should happen, but can happen asynchronously to the
// audio thread making rendering progress.
void ScheduleMainThreadCleanup();
void PerformCleanupOnMainThread();
// When the context is going away, reject any pending script promise
// resolvers.
virtual void RejectPendingResolvers();
......
......@@ -379,6 +379,8 @@ void OfflineAudioContext::FireCompletionEvent() {
}
is_rendering_started_ = false;
PerformCleanupOnMainThread();
}
bool OfflineAudioContext::HandlePreOfflineRenderTasks() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment