Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp

Issue 2889393003: Lazy initialization of the rendering thread in OfflineAudioContext (Closed)
Patch Set: Adjusting number of contexts for timed-out trybots Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
index 1b310a9db147308bf597838d58b70511ed36e1ad..b7dcfba502017f5db926028a233f844fc4581fac 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp
@@ -212,6 +212,7 @@ ScriptPromise OfflineAudioContext::startOfflineRendering(
// Start rendering and return the promise.
is_rendering_started_ = true;
SetContextState(kRunning);
+ DestinationHandler().InitializeOfflineRenderThread();
DestinationHandler().StartRendering();
return complete_resolver_->Promise();
@@ -230,8 +231,8 @@ ScriptPromise OfflineAudioContext::suspendContext(ScriptState* script_state,
ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
ScriptPromise promise = resolver->Promise();
- // The render thread does not exist; reject the promise.
- if (!DestinationHandler().OfflineRenderThread()) {
+ // If the rendering is finished, reject the promise.
+ if (ContextState() == AudioContextState::kClosed) {
resolver->Reject(DOMException::Create(kInvalidStateError,
"the rendering is already finished"));
return promise;

Powered by Google App Engine
This is Rietveld 408576698