OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 AudioContext* AudioContext::create(Document& document, | 36 AudioContext* AudioContext::create(Document& document, |
37 const AudioContextOptions& contextOptions, | 37 const AudioContextOptions& contextOptions, |
38 ExceptionState& exceptionState) { | 38 ExceptionState& exceptionState) { |
39 DCHECK(isMainThread()); | 39 DCHECK(isMainThread()); |
40 | 40 |
41 UseCounter::countCrossOriginIframe(document, | 41 UseCounter::countCrossOriginIframe(document, |
42 UseCounter::AudioContextCrossOriginIframe); | 42 UseCounter::AudioContextCrossOriginIframe); |
43 | 43 |
44 if (s_hardwareContextCount >= MaxHardwareContexts) { | 44 if (s_hardwareContextCount >= MaxHardwareContexts) { |
45 exceptionState.throwDOMException( | 45 exceptionState.throwDOMException( |
46 NotSupportedError, ExceptionMessages::indexExceedsMaximumBound( | 46 NotSupportedError, |
47 "number of hardware contexts", | 47 ExceptionMessages::indexExceedsMaximumBound( |
48 s_hardwareContextCount, MaxHardwareContexts)); | 48 "number of hardware contexts", s_hardwareContextCount, |
| 49 MaxHardwareContexts)); |
49 return nullptr; | 50 return nullptr; |
50 } | 51 } |
51 | 52 |
52 WebAudioLatencyHint latencyHint(WebAudioLatencyHint::kCategoryInteractive); | 53 WebAudioLatencyHint latencyHint(WebAudioLatencyHint::kCategoryInteractive); |
53 if (contextOptions.latencyHint().isAudioContextLatencyCategory()) { | 54 if (contextOptions.latencyHint().isAudioContextLatencyCategory()) { |
54 latencyHint = WebAudioLatencyHint( | 55 latencyHint = WebAudioLatencyHint( |
55 contextOptions.latencyHint().getAsAudioContextLatencyCategory()); | 56 contextOptions.latencyHint().getAsAudioContextLatencyCategory()); |
56 } | 57 } |
57 // TODO: add support for latencyHint().isDouble() | 58 // TODO: add support for latencyHint().isDouble() |
58 | 59 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 setContextState(Suspended); | 250 setContextState(Suspended); |
250 deferredTaskHandler().clearHandlersToBeDeleted(); | 251 deferredTaskHandler().clearHandlersToBeDeleted(); |
251 } | 252 } |
252 } | 253 } |
253 | 254 |
254 double AudioContext::baseLatency() const { | 255 double AudioContext::baseLatency() const { |
255 return framesPerBuffer() * 2 / static_cast<double>(sampleRate()); | 256 return framesPerBuffer() * 2 / static_cast<double>(sampleRate()); |
256 } | 257 } |
257 | 258 |
258 } // namespace blink | 259 } // namespace blink |
OLD | NEW |