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

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

Issue 2717613007: Set "Running" state only when actually running (Closed)
Patch Set: State must be set AFTER startRendering(). Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
index e71b37d8df9c79727cbc063548293b95c4823a87..4813a821ca2a026289282b9bd70bfca354b2ad3d 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
@@ -79,8 +79,10 @@ AudioContext* AudioContext::create(Document& document,
// startRendering() call from JavaScript. We may want to consider
// requiring it for symmetry with OfflineAudioContext.
audioContext->maybeUnlockUserGesture();
- if (audioContext->isAllowedToStart())
+ if (audioContext->isAllowedToStart()) {
audioContext->startRendering();
+ audioContext->setContextState(Running);
+ }
++s_hardwareContextCount;
#if DEBUG_AUDIONODE_REFERENCES
fprintf(stderr, "[%16p]: AudioContext::AudioContext(): %u #%u\n",
@@ -156,8 +158,11 @@ ScriptPromise AudioContext::resumeContext(ScriptState* scriptState) {
// Restart the destination node to pull on the audio graph.
if (destination()) {
maybeUnlockUserGesture();
- if (isAllowedToStart())
+ if (isAllowedToStart()) {
+ // Do not set the state to running here. We wait for the
+ // destination to start to set the state.
startRendering();
+ }
}
// Save the resolver which will get resolved when the destination node starts
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698