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