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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioContext.cpp

Issue 2031393003: WebAudio: record whether user gesture was available and provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webaudio/AudioContext.h" 5 #include "modules/webaudio/AudioContext.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ASSERT(isMainThread()); 117 ASSERT(isMainThread());
118 118
119 if (isContextClosed()) { 119 if (isContextClosed()) {
120 return ScriptPromise::rejectWithDOMException( 120 return ScriptPromise::rejectWithDOMException(
121 scriptState, 121 scriptState,
122 DOMException::create( 122 DOMException::create(
123 InvalidAccessError, 123 InvalidAccessError,
124 "cannot resume a closed AudioContext")); 124 "cannot resume a closed AudioContext"));
125 } 125 }
126 126
127 recordUserGestureState();
128
127 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 129 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
128 ScriptPromise promise = resolver->promise(); 130 ScriptPromise promise = resolver->promise();
129 131
130 // Restart the destination node to pull on the audio graph. 132 // Restart the destination node to pull on the audio graph.
131 if (destination()) 133 if (destination())
132 startRendering(); 134 startRendering();
133 135
134 // Save the resolver which will get resolved when the destination node start s pulling on the 136 // Save the resolver which will get resolved when the destination node start s pulling on the
135 // graph again. 137 // graph again.
136 { 138 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ASSERT(destination()); 193 ASSERT(destination());
192 194
193 if (contextState() == Running) { 195 if (contextState() == Running) {
194 destination()->audioDestinationHandler().stopRendering(); 196 destination()->audioDestinationHandler().stopRendering();
195 setContextState(Suspended); 197 setContextState(Suspended);
196 deferredTaskHandler().clearHandlersToBeDeleted(); 198 deferredTaskHandler().clearHandlersToBeDeleted();
197 } 199 }
198 } 200 }
199 201
200 } // namespace blink 202 } // namespace blink
201
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698