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