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

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

Issue 1865583002: Implement BaseAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/frame/UseCounter.h" 12 #include "core/frame/UseCounter.h"
13 #include "modules/webaudio/AudioBufferCallback.h" 13 #include "modules/webaudio/AudioBufferCallback.h"
14 #include "platform/Histogram.h" 14 #include "platform/Histogram.h"
15 #include "platform/audio/AudioUtilities.h" 15 #include "platform/audio/AudioUtilities.h"
16 16
17 #if DEBUG_AUDIONODE_REFERENCES 17 #if DEBUG_AUDIONODE_REFERENCES
18 #include <stdio.h> 18 #include <stdio.h>
19 #endif 19 #endif
20 20
21 namespace blink { 21 namespace blink {
22 22
23 // Don't allow more than this number of simultaneous AudioContexts 23 // Don't allow more than this number of simultaneous AudioContexts
24 // talking to hardware. 24 // talking to hardware.
25 const unsigned MaxHardwareContexts = 6; 25 const unsigned MaxHardwareContexts = 6;
26 static unsigned s_hardwareContextCount = 0; 26 static unsigned s_hardwareContextCount = 0;
27 static unsigned s_contextId = 0; 27 static unsigned s_contextId = 0;
28 28
29 BaseAudioContext* AudioContext::create(Document& document, ExceptionState& excep tionState) 29 AudioContext* AudioContext::create(Document& document, ExceptionState& exception State)
30 { 30 {
31 DCHECK(isMainThread()); 31 DCHECK(isMainThread());
32 32
33 UseCounter::countCrossOriginIframe(document, UseCounter::AudioContextCrossOr iginIframe); 33 UseCounter::countCrossOriginIframe(document, UseCounter::AudioContextCrossOr iginIframe);
34 34
35 if (s_hardwareContextCount >= MaxHardwareContexts) { 35 if (s_hardwareContextCount >= MaxHardwareContexts) {
36 exceptionState.throwDOMException( 36 exceptionState.throwDOMException(
37 NotSupportedError, 37 NotSupportedError,
38 ExceptionMessages::indexExceedsMaximumBound( 38 ExceptionMessages::indexExceedsMaximumBound(
39 "number of hardware contexts", 39 "number of hardware contexts",
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 DCHECK(destination()); 205 DCHECK(destination());
206 206
207 if (contextState() == Running) { 207 if (contextState() == Running) {
208 destination()->audioDestinationHandler().stopRendering(); 208 destination()->audioDestinationHandler().stopRendering();
209 setContextState(Suspended); 209 setContextState(Suspended);
210 deferredTaskHandler().clearHandlersToBeDeleted(); 210 deferredTaskHandler().clearHandlersToBeDeleted();
211 } 211 }
212 } 212 }
213 213
214 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioContext.h ('k') | third_party/WebKit/Source/modules/webaudio/AudioContext.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698