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 #ifndef AudioContext_h | 5 #ifndef AudioContext_h |
6 #define AudioContext_h | 6 #define AudioContext_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "modules/webaudio/AudioContextOptions.h" |
10 #include "modules/webaudio/BaseAudioContext.h" | 11 #include "modules/webaudio/BaseAudioContext.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
| 16 class AudioContextOptions; |
15 class AudioTimestamp; | 17 class AudioTimestamp; |
16 class Document; | 18 class Document; |
17 class ExceptionState; | 19 class ExceptionState; |
18 class ScriptState; | 20 class ScriptState; |
| 21 class WebAudioLatencyHint; |
19 | 22 |
20 // This is an BaseAudioContext which actually plays sound, unlike an | 23 // This is an BaseAudioContext which actually plays sound, unlike an |
21 // OfflineAudioContext which renders sound into a buffer. | 24 // OfflineAudioContext which renders sound into a buffer. |
22 class AudioContext : public BaseAudioContext { | 25 class MODULES_EXPORT AudioContext : public BaseAudioContext { |
23 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
24 | 27 |
25 public: | 28 public: |
26 static AudioContext* create(Document&, ExceptionState&); | 29 static AudioContext* create(Document&, |
| 30 const AudioContextOptions&, |
| 31 ExceptionState&); |
27 | 32 |
28 ~AudioContext() override; | 33 ~AudioContext() override; |
29 DECLARE_VIRTUAL_TRACE(); | 34 DECLARE_VIRTUAL_TRACE(); |
30 | 35 |
31 ScriptPromise closeContext(ScriptState*); | 36 ScriptPromise closeContext(ScriptState*); |
32 bool isContextClosed() const final; | 37 bool isContextClosed() const final; |
33 | 38 |
34 ScriptPromise suspendContext(ScriptState*) final; | 39 ScriptPromise suspendContext(ScriptState*) final; |
35 ScriptPromise resumeContext(ScriptState*) final; | 40 ScriptPromise resumeContext(ScriptState*) final; |
36 | 41 |
37 bool hasRealtimeConstraint() final { return true; } | 42 bool hasRealtimeConstraint() final { return true; } |
38 | 43 |
39 void getOutputTimestamp(ScriptState*, AudioTimestamp&); | 44 void getOutputTimestamp(ScriptState*, AudioTimestamp&); |
| 45 double baseLatency() const; |
40 | 46 |
41 protected: | 47 protected: |
42 AudioContext(Document&); | 48 AudioContext(Document&, const WebAudioLatencyHint&); |
43 | 49 |
44 void didClose() final; | 50 void didClose() final; |
45 | 51 |
46 private: | 52 private: |
47 void stopRendering(); | 53 void stopRendering(); |
48 | 54 |
49 unsigned m_contextId; | 55 unsigned m_contextId; |
50 Member<ScriptPromiseResolver> m_closeResolver; | 56 Member<ScriptPromiseResolver> m_closeResolver; |
51 }; | 57 }; |
52 | 58 |
53 } // namespace blink | 59 } // namespace blink |
54 | 60 |
55 #endif // AudioContext_h | 61 #endif // AudioContext_h |
OLD | NEW |