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

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

Issue 1405413004: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing resuming behavior according to TPAC decision Created 5 years, 1 month 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 "config.h" 5 #include "config.h"
6 #include "modules/webaudio/AudioContext.h" 6 #include "modules/webaudio/AudioContext.h"
7 7
8 #include "bindings/core/v8/ExceptionMessages.h" 8 #include "bindings/core/v8/ExceptionMessages.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Save the resolver which will get resolved when the destination node start s pulling on the 123 // Save the resolver which will get resolved when the destination node start s pulling on the
124 // graph again. 124 // graph again.
125 { 125 {
126 AutoLocker locker(this); 126 AutoLocker locker(this);
127 m_resumeResolvers.append(resolver); 127 m_resumeResolvers.append(resolver);
128 } 128 }
129 129
130 return promise; 130 return promise;
131 } 131 }
132 132
133 ScriptPromise AudioContext::suspendContext(ScriptState* scriptState, double susp endTime)
134 {
135 // This CANNOT be called on AudioContext; it is to implement the pure
136 // virtual interface from AbstractAudioContext.
137 RELEASE_ASSERT_NOT_REACHED();
138
139 return ScriptPromise::rejectWithDOMException(
yhirano 2015/11/06 08:13:29 RELEASE_ASSERT always takes effect, so L139-L142 d
hongchan 2015/11/06 19:33:40 Since we don't need to define this at all here, I
140 scriptState,
141 DOMException::create(InvalidStateError,
142 "Only offline audio context can be suspended at the specified time." ));
143 }
144
133 ScriptPromise AudioContext::closeContext(ScriptState* scriptState) 145 ScriptPromise AudioContext::closeContext(ScriptState* scriptState)
134 { 146 {
135 if (isContextClosed()) { 147 if (isContextClosed()) {
136 // We've already closed the context previously, but it hasn't yet been r esolved, so just 148 // We've already closed the context previously, but it hasn't yet been r esolved, so just
137 // create a new promise and reject it. 149 // create a new promise and reject it.
138 return ScriptPromise::rejectWithDOMException( 150 return ScriptPromise::rejectWithDOMException(
139 scriptState, 151 scriptState,
140 DOMException::create(InvalidStateError, 152 DOMException::create(InvalidStateError,
141 "Cannot close a context that is being closed or has already been closed.")); 153 "Cannot close a context that is being closed or has already been closed."));
142 } 154 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (contextState() == Running) { 191 if (contextState() == Running) {
180 destination()->audioDestinationHandler().stopRendering(); 192 destination()->audioDestinationHandler().stopRendering();
181 setContextState(Suspended); 193 setContextState(Suspended);
182 deferredTaskHandler().clearHandlersToBeDeleted(); 194 deferredTaskHandler().clearHandlersToBeDeleted();
183 } 195 }
184 } 196 }
185 197
186 } // namespace blink 198 } // namespace blink
187 199
188 #endif // ENABLE(WEB_AUDIO) 200 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698